Fix SonarQube warnings: reduce returns, extract constants, fix viewport
- Reduce requireStripeReady() from 4 returns to 2 by combining conditions - Extract SCANNER_PATH constant in ScannerController to avoid duplicated "/scanner/" literal - Remove user-scalable=no from scanner viewport meta (WCAG accessibility) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1559,15 +1559,10 @@ class AccountController extends AbstractController
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
|
||||
if (!$user->isStripeChargesEnabled() || !$user->isStripePayoutsEnabled()) {
|
||||
return $this->redirectToRoute('app_account');
|
||||
}
|
||||
$stripeNotReady = !$user->isStripeChargesEnabled() || !$user->isStripePayoutsEnabled();
|
||||
$billingBlocked = $user->isBilling() && 'good' !== $user->getBillingState();
|
||||
|
||||
if ($user->isBilling() && 'good' !== $user->getBillingState()) {
|
||||
return $this->redirectToRoute('app_account');
|
||||
}
|
||||
|
||||
return null;
|
||||
return ($stripeNotReady || $billingBlocked) ? $this->redirectToRoute('app_account') : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,8 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class ScannerController extends AbstractController
|
||||
{
|
||||
private const SCANNER_PATH = '/scanner/';
|
||||
|
||||
#[Route('/scanner/', name: 'app_scanner', methods: ['GET'])]
|
||||
public function index(): Response
|
||||
{
|
||||
@@ -21,8 +23,8 @@ class ScannerController extends AbstractController
|
||||
'name' => 'E-Ticket Scanner',
|
||||
'short_name' => 'Scanner',
|
||||
'description' => 'Application de scan de billets pour organisateurs',
|
||||
'start_url' => '/scanner/',
|
||||
'scope' => '/scanner/',
|
||||
'start_url' => self::SCANNER_PATH,
|
||||
'scope' => self::SCANNER_PATH,
|
||||
'display' => 'standalone',
|
||||
'orientation' => 'portrait',
|
||||
'theme_color' => '#111827',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>E-Ticket Scanner</title>
|
||||
<link rel="manifest" href="{{ path('app_scanner_manifest') }}">
|
||||
<meta name="theme-color" content="#111827">
|
||||
|
||||
Reference in New Issue
Block a user