src/Controller/UserPlatformController.php line 14
<?phpnamespace App\Controller;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;use Symfony\Component\Security\Http\Attribute\IsGranted;#[IsGranted('ROLE_USER')]class UserPlatformController extends AbstractController{#[Route('/platforms', name: 'app_user_platforms')]public function index(): Response{$state = $this->generateRandomString();$vkUrl = "https://ads.vk.com/hq/settings/access?action=oauth2&client_id=7XG62PqTbNY8smMK&response_type=code&scope=read_manager_clients,edit_manager_clients,read_payments&state=$state";$platforms = $this->getUser()->getUserPlatforms();return $this->render('user_platform/index.html.twig', ['vkUrl' => $vkUrl,'platforms' => $platforms,]);}function generateRandomString($length = 10): string{$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';$charactersLength = strlen($characters);$randomString = '';for ($i = 0; $i < $length; $i++) {$randomString .= $characters[random_int(0, $charactersLength - 1)];}return $randomString;}}