@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the AutomatedEditsHelper class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Helper; |
| 9 | 9 | |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $revertEntries = array_filter( |
| 153 | 153 | $this->getTools($project), |
| 154 | - function ($tool) { |
|
| 154 | + function($tool) { |
|
| 155 | 155 | return isset($tool['revert']); |
| 156 | 156 | } |
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | 159 | // If 'revert' is set to `true`, then use 'regex' as the regular expression, |
| 160 | 160 | // otherwise 'revert' is assumed to be the regex string. |
| 161 | - $this->revertTools[$projectDomain] = array_map(function ($revertTool) { |
|
| 161 | + $this->revertTools[$projectDomain] = array_map(function($revertTool) { |
|
| 162 | 162 | return [ |
| 163 | 163 | 'link' => $revertTool['link'], |
| 164 | 164 | 'regex' => true === $revertTool['revert'] ? $revertTool['regex'] : $revertTool['revert'], |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * This file contains only the HelperBase class. |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * This file contains only the AppBundle class. |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * This file contains only the ExceptionListener class. |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * This file contains only the RateLimitSubscriber class. |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function onKernelController(FilterControllerEvent $event): void |
| 58 | 58 | { |
| 59 | - $this->rateLimit = (int) $this->container->getParameter('app.rate_limit_count'); |
|
| 60 | - $this->rateDuration = (int) $this->container->getParameter('app.rate_limit_time'); |
|
| 59 | + $this->rateLimit = (int)$this->container->getParameter('app.rate_limit_count'); |
|
| 60 | + $this->rateDuration = (int)$this->container->getParameter('app.rate_limit_time'); |
|
| 61 | 61 | |
| 62 | 62 | // Zero values indicate the rate limiting feature should be disabled. |
| 63 | 63 | if (0 === $this->rateLimit || 0 === $this->rateDuration) { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $controller = $event->getController(); |
| 68 | - $loggedIn = (bool) $this->container->get('session')->get('logged_in_user'); |
|
| 68 | + $loggedIn = (bool)$this->container->get('session')->get('logged_in_user'); |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Rate limiting will not apply to these actions |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $cacheItem = $cache->getItem($cacheKey); |
| 92 | 92 | |
| 93 | 93 | // If increment value already in cache, or start with 1. |
| 94 | - $count = $cacheItem->isHit() ? (int) $cacheItem->get() + 1 : 1; |
|
| 94 | + $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1; |
|
| 95 | 95 | |
| 96 | 96 | // Check if limit has been exceeded, and if so, throw an error. |
| 97 | 97 | if ($count > $this->rateLimit) { |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | // Log the denied request |
| 145 | 145 | $logger = $this->container->get('monolog.logger.rate_limit'); |
| 146 | 146 | $logger->info( |
| 147 | - "<URI>: " . $request->getRequestUri() . |
|
| 148 | - ('' != $logComment ? "\t<Reason>: $logComment" : '') . |
|
| 149 | - "\t<User agent>: " . $request->headers->get('User-Agent') |
|
| 147 | + "<URI>: ".$request->getRequestUri(). |
|
| 148 | + ('' != $logComment ? "\t<Reason>: $logComment" : ''). |
|
| 149 | + "\t<User agent>: ".$request->headers->get('User-Agent') |
|
| 150 | 150 | ); |
| 151 | 151 | |
| 152 | 152 | throw new TooManyRequestsHttpException(600, 'error-rate-limit', null, $this->rateDuration); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * This file contains only the DisabledToolSubscriber class. |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * This file contains only the AppExtension class. |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | public function requestTime(): float |
| 109 | 109 | { |
| 110 | 110 | if (!isset($this->requestTime)) { |
| 111 | - $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 111 | + $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | return $this->requestTime; |
@@ -660,15 +660,15 @@ discard block |
||
| 660 | 660 | |
| 661 | 661 | if ($seconds >= 86400) { |
| 662 | 662 | // Over a day |
| 663 | - $val = (int) floor($seconds / 86400); |
|
| 663 | + $val = (int)floor($seconds / 86400); |
|
| 664 | 664 | $key = 'days'; |
| 665 | 665 | } elseif ($seconds >= 3600) { |
| 666 | 666 | // Over an hour, less than a day |
| 667 | - $val = (int) floor($seconds / 3600); |
|
| 667 | + $val = (int)floor($seconds / 3600); |
|
| 668 | 668 | $key = 'hours'; |
| 669 | 669 | } elseif ($seconds >= 60) { |
| 670 | 670 | // Over a minute, less than an hour |
| 671 | - $val = (int) floor($seconds / 60); |
|
| 671 | + $val = (int)floor($seconds / 60); |
|
| 672 | 672 | $key = 'minutes'; |
| 673 | 673 | } |
| 674 | 674 | |