Completed
Push — master ( 629a26...60e73f )
by Michal
14:10
created
src/Misc/ConsoleRequest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                     } elseif ($param->getType() === InputParam::TYPE_COOKIE) {
170 170
                         $cookieFields[$key][] = $valueData;
171 171
                     } else {
172
-                        $getFields[$key][] = urlencode((string)$valueData);
172
+                        $getFields[$key][] = urlencode((string) $valueData);
173 173
                     }
174 174
                 } else {
175 175
                     if (in_array($param->getType(), [InputParam::TYPE_POST, InputParam::TYPE_FILE])) {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                     } elseif ($param->getType() === InputParam::TYPE_COOKIE) {
180 180
                         $cookieFields[$key] = $valueData;
181 181
                     } else {
182
-                        $getFields[$key] = urlencode((string)$valueData);
182
+                        $getFields[$key] = urlencode((string) $valueData);
183 183
                     }
184 184
                 }
185 185
             }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $result = [];
225 225
         foreach ($values as $key => $value) {
226
-            if (!is_array($value)) {
226
+            if ( ! is_array($value)) {
227 227
                 $result[$key] = $value;
228 228
                 continue;
229 229
             }
Please login to merge, or discard this patch.
src/Link/ApiLinkMacro.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
         if (count($args) < 3) {
31 31
             $message = "Invalid link destination, too few arguments.";
32
-            if (!Debugger::$productionMode) {
32
+            if ( ! Debugger::$productionMode) {
33 33
                 throw new InvalidLinkException($message);
34 34
             }
35 35
             Debugger::log($message, Debugger::EXCEPTION);
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
         ];
46 46
 
47 47
         return $writer->write('echo ($this->filters->apiLink)((new Tomaj\NetteApi\EndpointIdentifier(' .
48
-            $arguments['method']  . ', ' .
49
-            $arguments['version']  . ', ' .
48
+            $arguments['method'] . ', ' .
49
+            $arguments['version'] . ', ' .
50 50
             $arguments['package'] . ', ' .
51 51
             $arguments['action'] . ')), ' . $arguments['params'] . ')');
52 52
     }
Please login to merge, or discard this patch.
src/Presenters/ApiPresenter.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $paramsProcessor = new ParamsProcessor($handler->params());
84 84
         if ($paramsProcessor->isError()) {
85 85
             $this->response->setCode(Response::S400_BAD_REQUEST);
86
-            if (!Debugger::$productionMode) {
86
+            if ( ! Debugger::$productionMode) {
87 87
                 $response = new JsonResponse(['status' => 'error', 'message' => 'wrong input', 'detail' => $paramsProcessor->getErrors()]);
88 88
             } else {
89 89
                 $response = new JsonResponse(['status' => 'error', 'message' => 'wrong input']);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             $outputValid = count($handler->outputs()) === 0; // back compatibility for handlers with no outputs defined
98 98
             $outputValidatorErrors = [];
99 99
             foreach ($handler->outputs() as $output) {
100
-                if (!$output instanceof OutputInterface) {
100
+                if ( ! $output instanceof OutputInterface) {
101 101
                     $outputValidatorErrors[] = ["Output does not implement OutputInterface"];
102 102
                     continue;
103 103
                 }
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
                 }
109 109
                 $outputValidatorErrors[] = $validationResult->getErrors();
110 110
             }
111
-            if (!$outputValid) {
111
+            if ( ! $outputValid) {
112 112
                 Debugger::log($outputValidatorErrors, Debugger::ERROR);
113
-                if (!Debugger::$productionMode) {
113
+                if ( ! Debugger::$productionMode) {
114 114
                     $response = new JsonApiResponse(Response::S500_INTERNAL_SERVER_ERROR, ['status' => 'error', 'message' => 'Internal server error', 'details' => $outputValidatorErrors]);
115 115
                 }
116 116
             }
117 117
             $code = $response->getCode();
118 118
         } catch (Throwable $exception) {
119
-            if (!Debugger::$productionMode) {
119
+            if ( ! Debugger::$productionMode) {
120 120
                 $response = new JsonApiResponse(Response::S500_INTERNAL_SERVER_ERROR, ['status' => 'error', 'message' => 'Internal server error', 'detail' => $exception->getMessage()]);
121 121
             } else {
122 122
                 $response = new JsonApiResponse(Response::S500_INTERNAL_SERVER_ERROR, ['status' => 'error', 'message' => 'Internal server error']);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
     private function checkAuth(ApiAuthorizationInterface $authorization): ?IResponse
152 152
     {
153
-        if (!$authorization->authorized()) {
153
+        if ( ! $authorization->authorized()) {
154 154
             $this->response->setCode(Response::S403_FORBIDDEN);
155 155
             return new JsonResponse(['status' => 'error', 'message' => $authorization->getErrorMessage()]);
156 156
         }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     private function checkRateLimit(RateLimitInterface $rateLimit): ?IResponse
161 161
     {
162 162
         $rateLimitResponse = $rateLimit->check();
163
-        if (!$rateLimitResponse) {
163
+        if ( ! $rateLimitResponse) {
164 164
             return null;
165 165
         }
166 166
 
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
         $remaining = $rateLimitResponse->getRemaining();
169 169
         $retryAfter = $rateLimitResponse->getRetryAfter();
170 170
 
171
-        $this->response->addHeader('X-RateLimit-Limit', (string)$limit);
172
-        $this->response->addHeader('X-RateLimit-Remaining', (string)$remaining);
171
+        $this->response->addHeader('X-RateLimit-Limit', (string) $limit);
172
+        $this->response->addHeader('X-RateLimit-Remaining', (string) $remaining);
173 173
 
174 174
         if ($remaining === 0) {
175 175
             $this->response->setCode(Response::S429_TOO_MANY_REQUESTS);
176
-            $this->response->addHeader('Retry-After', (string)$retryAfter);
176
+            $this->response->addHeader('Retry-After', (string) $retryAfter);
177 177
             return $rateLimitResponse->getErrorResponse() ?: new JsonResponse(['status' => 'error', 'message' => 'Too many requests. Retry after ' . $retryAfter . ' seconds.']);
178 178
         }
179 179
         return null;
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 
236 236
     private function getRequestDomain(): ?string
237 237
     {
238
-        if (!filter_input(INPUT_SERVER, 'HTTP_REFERER')) {
238
+        if ( ! filter_input(INPUT_SERVER, 'HTTP_REFERER')) {
239 239
             return null;
240 240
         }
241 241
         $refererParsedUrl = parse_url(filter_input(INPUT_SERVER, 'HTTP_REFERER'));
242
-        if (!(isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) {
242
+        if ( ! (isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) {
243 243
             return null;
244 244
         }
245 245
         $url = $refererParsedUrl['scheme'] . '://' . $refererParsedUrl['host'];
Please login to merge, or discard this patch.
src/Params/JsonInputParam.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,11 +46,11 @@
 block discarded – undo
46 46
             return new ValidationResult(ValidationResult::STATUS_ERROR, ['missing data']);
47 47
         }
48 48
 
49
-        if (!empty($this->rawInput) && json_last_error()) {
49
+        if ( ! empty($this->rawInput) && json_last_error()) {
50 50
             return new ValidationResult(ValidationResult::STATUS_ERROR, [json_last_error_msg()]);
51 51
         }
52 52
 
53
-        if (!$value && $this->isRequired() === self::OPTIONAL) {
53
+        if ( ! $value && $this->isRequired() === self::OPTIONAL) {
54 54
             return new ValidationResult(ValidationResult::STATUS_OK);
55 55
         }
56 56
 
Please login to merge, or discard this patch.