Completed
Pull Request — master (#12)
by
unknown
01:49
created
DependencyInjection/Configuration.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
                 ->end()
53 53
                 ->arrayNode('throttle')
54 54
                     ->beforeNormalization()
55
-                        ->ifTrue(function ($v) { return is_array($v) && (isset($v['limit']) || isset($v['period'])); })
56
-                        ->then(function ($v) {
55
+                        ->ifTrue(function($v) { return is_array($v) && (isset($v['limit']) || isset($v['period'])); })
56
+                        ->then(function($v) {
57 57
                             $v['default'] = [];
58 58
                             if (isset($v['limit'])) {
59 59
                                 @trigger_error('The indragunawan_api_rate_limit.throttle.limit configuration key is deprecated since version v0.2.0 and will be removed in v0.3.0. Use the indragunawan_api_rate_limit.throttle.default.limit configuration key instead.', E_USER_DEPRECATED);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                             ->cannotBeEmpty()
108 108
                             ->defaultNull()
109 109
                             ->validate()
110
-                            ->ifTrue(function ($v) {
110
+                            ->ifTrue(function($v) {
111 111
                                 if (!class_exists($v)) {
112 112
                                     return true;
113 113
                                 }
Please login to merge, or discard this patch.
DependencyInjection/IndragunawanApiRateLimitExtension.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@
 block discarded – undo
65 65
         }
66 66
 
67 67
         if ('rate-limit-asc' === $config['throttle']['sort']) {
68
-            uasort($config['throttle']['roles'], function (array $a, array $b) {
68
+            uasort($config['throttle']['roles'], function(array $a, array $b) {
69 69
                 return ($a['limit'] / $a['period']) <=> ($b['limit'] / $b['period']);
70 70
             });
71 71
         } elseif ('rate-limit-desc' === $config['throttle']['sort']) {
72
-            uasort($config['throttle']['roles'], function (array $a, array $b) {
72
+            uasort($config['throttle']['roles'], function(array $a, array $b) {
73 73
                 return ($b['limit'] / $b['period']) <=> ($a['limit'] / $a['period']);
74 74
             });
75 75
         }
Please login to merge, or discard this patch.
Service/RateLimitHandler.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,8 +156,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.