src/Controller/HomeController.php line 36
<?phpnamespace App\Controller;use App\Balance\BalanceService;use App\ReportService;use App\TagService;use App\UserService;use App\Util\Audio;use App\Util\Formatter;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;class HomeController extends AbstractController{#[Route('/account', name: 'app_account', methods: 'GET')]public function account(UserService $userService, BalanceService $balanceService): Response{$user = $userService->getUser();$data = ['name' => $user->getFullName(),'email' => $user->getEmail(),'employer' => $user->getEmployer(),'occupation' => $user->getOccupation(),'level' => Formatter::formatMoney($user->getTransactionDefaultAmount()),'balance' => Formatter::formatMoney($balanceService->getBalanceForUser($user)),];return $this->render('home/account.html.twig', ['data' => $data,]);}#[Route('/{tagId}', name: 'app_home', methods: 'GET', priority: -1)]public function index(Audio $audioUtil,UserService $userService,TagService $tagService,BalanceService $balanceService,Request $request,?string $tagId = null): Response{$user = $userService->getUser();if (empty($user)) {return $this->redirectToRoute('app_login');}// captures the tag and redirects user back to the same page but without tag in the url// this way we can capture only real scans, mostlyif ($tagId) {$aid = (int)($request->query->get('AID') ?? $request->query->get('aid'));$tagService->captureTagAndAudience($tagId, $aid);return $this->redirectToRoute('app_home');}$data = ['name' => $user->getFullName(),'canMakeDonation' => $balanceService->canMakeDonation(),'level' => Formatter::formatMoney($user->getTransactionDefaultAmount()),'audioFile' => $audioUtil->getRandomFileName(),];return $this->render('home/index.html.twig', ['data' => $data,]);}}