@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the RateLimitSubscriber class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\EventSubscriber; |
| 9 | 9 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function onKernelController(FilterControllerEvent $event): void |
| 65 | 65 | { |
| 66 | - $this->rateLimit = (int) $this->container->getParameter('app.rate_limit_count'); |
|
| 67 | - $this->rateDuration = (int) $this->container->getParameter('app.rate_limit_time'); |
|
| 66 | + $this->rateLimit = (int)$this->container->getParameter('app.rate_limit_count'); |
|
| 67 | + $this->rateDuration = (int)$this->container->getParameter('app.rate_limit_time'); |
|
| 68 | 68 | $request = $event->getRequest(); |
| 69 | 69 | |
| 70 | 70 | $this->checkBlacklist($request); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $controller = $event->getController(); |
| 78 | - $loggedIn = (bool) $this->container->get('session')->get('logged_in_user'); |
|
| 78 | + $loggedIn = (bool)$this->container->get('session')->get('logged_in_user'); |
|
| 79 | 79 | $isApi = substr($controller[1], -3); |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $cacheItem = $cache->getItem($cacheKey); |
| 101 | 101 | |
| 102 | 102 | // If increment value already in cache, or start with 1. |
| 103 | - $count = $cacheItem->isHit() ? (int) $cacheItem->get() + 1 : 1; |
|
| 103 | + $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1; |
|
| 104 | 104 | |
| 105 | 105 | // Check if limit has been exceeded, and if so, throw an error. |
| 106 | 106 | if ($count > $this->rateLimit) { |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | $message = $this->i18n->msg('error-rate-limit', [ |
| 179 | 179 | $this->rateDuration, |
| 180 | 180 | "<a href='/login'>".$this->i18n->msg('error-rate-limit-login')."</a>", |
| 181 | - "<a href='https://xtools.readthedocs.io/en/stable/api' target='_blank'>" . |
|
| 182 | - $this->i18n->msg('api') . |
|
| 181 | + "<a href='https://xtools.readthedocs.io/en/stable/api' target='_blank'>". |
|
| 182 | + $this->i18n->msg('api'). |
|
| 183 | 183 | "</a>", |
| 184 | 184 | ]); |
| 185 | 185 | |