@@ -156,8 +156,8 @@ |
||
| 156 | 156 | $annotation = new ApiRateLimit(); |
| 157 | 157 | } |
| 158 | 158 | } else { |
| 159 | - $annotation = new ApiRateLimit(); |
|
| 160 | - } |
|
| 159 | + $annotation = new ApiRateLimit(); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | 162 | list($key, $limit, $period) = $this->getThrottle($request, $annotation); |
| 163 | 163 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | public static function generateCacheKey(string $ip, string $username = null, string $userRole = null): string |
| 128 | 128 | { |
| 129 | 129 | if (!empty($username) && !empty($userRole)) { |
| 130 | - return sprintf('_api_rate_limit_metadata$%s', sha1($userRole . $username)); |
|
| 130 | + return sprintf('_api_rate_limit_metadata$%s', sha1($userRole.$username)); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | return sprintf('_api_rate_limit_metadata$%s', sha1($ip)); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | if (null !== $annotation) { |
| 153 | 153 | $this->enabled = $annotation->enabled; |
| 154 | - if(!in_array($request->getMethod(), array_map('strtoupper', $annotation->methods)) && !empty($annotation->methods)) { |
|
| 154 | + if (!in_array($request->getMethod(), array_map('strtoupper', $annotation->methods)) && !empty($annotation->methods)) { |
|
| 155 | 155 | // The annotation is ignored as the method is not corresponding |
| 156 | 156 | $annotation = new ApiRateLimit(); |
| 157 | 157 | } |