Completed
Pull Request — master (#164)
by
unknown
11:54
created
src/Authorization/BearerTokenAuthorization.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
     private const EXPECTED_HTTP_PARTS = 2;
13 13
 
14 14
     /**
15
-      * BearerTokenAuthorization constructor.
16
-      *
17
-      * @param TokenRepositoryInterface $tokenRepository
18
-      * @param IpDetectorInterface      $ipDetector
19
-      */
15
+     * BearerTokenAuthorization constructor.
16
+     *
17
+     * @param TokenRepositoryInterface $tokenRepository
18
+     * @param IpDetectorInterface      $ipDetector
19
+     */
20 20
     public function __construct(TokenRepositoryInterface $tokenRepository, IpDetectorInterface $ipDetector)
21 21
     {
22 22
         parent::__construct($tokenRepository, $ipDetector);
Please login to merge, or discard this patch.
src/Authorization/TokenAuthorization.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
         }
42 42
 
43 43
         $result = $this->tokenRepository->validToken($token);
44
-        if (!$result) {
44
+        if ( ! $result) {
45 45
             $this->errorMessage = 'Token doesn\'t exists or isn\'t active';
46 46
             return false;
47 47
         }
48 48
 
49
-        if (!$this->isValidIp($this->tokenRepository->ipRestrictions($token))) {
49
+        if ( ! $this->isValidIp($this->tokenRepository->ipRestrictions($token))) {
50 50
             $this->errorMessage = 'Invalid IP';
51 51
             return false;
52 52
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $range_decimal = ip2long($range);
111 111
         $ipDecimal = ip2long($ip);
112 112
         /** @phpstan-ignore-next-line */
113
-        $wildcard_decimal = pow(2, (32 - (int)$netmask)) - 1;
113
+        $wildcard_decimal = pow(2, (32 - (int) $netmask)) - 1;
114 114
         $netmask_decimal = ~ $wildcard_decimal;
115 115
         return (($ipDecimal & $netmask_decimal) === ($range_decimal & $netmask_decimal));
116 116
     }
Please login to merge, or discard this patch.
src/ApiDecider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 
58 58
     public function enableGlobalPreflight(?CorsPreflightHandlerInterface $corsHandler = null): void
59 59
     {
60
-        if (!$corsHandler) {
60
+        if ( ! $corsHandler) {
61 61
             $corsHandler = new CorsPreflightHandler(new Response());
62 62
         }
63 63
         $this->globalPreflightHandler = $corsHandler;
Please login to merge, or discard this patch.
src/Handlers/ApiListingHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
      */
56 56
     private function getApiList(string $version): array
57 57
     {
58
-        $versionApis = array_filter($this->apiDecider->getApis(), function (Api $api) use ($version) {
58
+        $versionApis = array_filter($this->apiDecider->getApis(), function(Api $api) use ($version) {
59 59
             return $version === $api->getEndpoint()->getVersion();
60 60
         });
61 61
 
62
-        return array_map(function (Api $api) {
62
+        return array_map(function(Api $api) {
63 63
             return [
64 64
                 'method' => $api->getEndpoint()->getMethod(),
65 65
                 'version' => $api->getEndpoint()->getVersion(),
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     private function createParamsList(ApiHandlerInterface $handler): array
83 83
     {
84 84
         /** @phpstan-ignore-next-line */
85
-        return array_map(function (InputParam $param): array {
85
+        return array_map(function(InputParam $param): array {
86 86
             $parameter = [
87 87
                 'type' => $param->getType(),
88 88
                 'key' => $param->getKey(),
Please login to merge, or discard this patch.
src/Handlers/OpenApiHandler.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
             'paths' => $this->getPaths($apis, $baseUrl, $basePath),
219 219
         ];
220 220
 
221
-        if (!$securitySchemes) {
221
+        if ( ! $securitySchemes) {
222 222
             unset($data['components']['securitySchemes']);
223 223
         }
224 224
 
225
-        if (!empty($this->definitions)) {
225
+        if ( ! empty($this->definitions)) {
226 226
             $data['components']['schemas'] = array_merge($this->definitions, $data['components']['schemas']);
227 227
         }
228 228
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      */
240 240
     private function getApis(string $version): array
241 241
     {
242
-        return array_filter($this->apiDecider->getApis(), function (Api $api) use ($version) {
242
+        return array_filter($this->apiDecider->getApis(), function(Api $api) use ($version) {
243 243
             return $version === $api->getEndpoint()->getVersion();
244 244
         });
245 245
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             $parameters = $this->createParamsList($handler);
273 273
             $requestBody = $this->createRequestBody($handler);
274 274
 
275
-            if (!empty($parameters) || !empty($requestBody)) {
275
+            if ( ! empty($parameters) || ! empty($requestBody)) {
276 276
                 $responses[IResponse::S400_BAD_REQUEST] = [
277 277
                     'description' => 'Bad request',
278 278
                     'content' => [
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 
288 288
             $authorization = $api->getAuthorization();
289 289
 
290
-            if (!$authorization instanceof NoAuthorization) {
290
+            if ( ! $authorization instanceof NoAuthorization) {
291 291
                 $responses[IResponse::S403_FORBIDDEN] = [
292 292
                     'description' => 'Operation forbidden',
293 293
                     'content' => [
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             foreach ($handler->outputs() as $output) {
315 315
                 if ($output instanceof JsonOutput) {
316 316
                     $schema = $this->transformSchema(json_decode($output->getSchema(), true));
317
-                    if (!isset($responses[$output->getCode()])) {
317
+                    if ( ! isset($responses[$output->getCode()])) {
318 318
                         $responses[$output->getCode()] = [
319 319
                             'description' => $output->getDescription(),
320 320
                             'content' => [
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                                 ],
324 324
                             ],
325 325
                         ];
326
-                        if (!empty($examples = $output->getExamples())) {
326
+                        if ( ! empty($examples = $output->getExamples())) {
327 327
                             if (count($examples) === 1) {
328 328
                                 $example = is_array($output->getExample()) ? $output->getExample() : json_decode($output->getExample(), true);
329 329
                                 /** @phpstan-ignore-next-line */
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
                             }
338 338
                         }
339 339
                     } else {
340
-                        if (!isset($responses[$output->getCode()]['content']['application/json; charset=utf-8']['schema']['oneOf'])) {
340
+                        if ( ! isset($responses[$output->getCode()]['content']['application/json; charset=utf-8']['schema']['oneOf'])) {
341 341
                             /** @phpstan-ignore-next-line */
342 342
                             $tmp = $responses[$output->getCode()]['content']['application/json; charset=utf-8']['schema'];
343 343
                             unset($responses[$output->getCode()]['content']['application/json; charset=utf-8']['schema']);
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
                 }
368 368
             }
369 369
 
370
-            if (!empty($parameters)) {
370
+            if ( ! empty($parameters)) {
371 371
                 $settings['parameters'] = $parameters;
372 372
             }
373 373
 
374
-            if (!empty($requestBody)) {
374
+            if ( ! empty($requestBody)) {
375 375
                 $settings['requestBody'] = $requestBody;
376 376
             }
377 377
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
         foreach ($handler->params() as $param) {
509 509
             if ($param instanceof JsonInputParam) {
510 510
                 $schema = json_decode($param->getSchema(), true);
511
-                if (!empty($examples = $param->getExamples())) {
511
+                if ( ! empty($examples = $param->getExamples())) {
512 512
                     if (count($examples) === 1) {
513 513
                         $schema['example'] = is_array($param->getExample()) ? $param->getExample() : json_decode($param->getExample(), true);
514 514
                     } else {
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
                 $schema = [
532 532
                     'type' => 'string',
533 533
                 ];
534
-                if (!empty($examples = $param->getExamples())) {
534
+                if ( ! empty($examples = $param->getExamples())) {
535 535
                     if (count($examples) === 1) {
536 536
                         $schema['example'] = $param->getExample();
537 537
                     } else {
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
             }
601 601
         }
602 602
 
603
-        if (!empty($requestBody['properties'])) {
603
+        if ( ! empty($requestBody['properties'])) {
604 604
             $requestBodySchema = [
605 605
                 'type' => 'object',
606 606
                 'properties' => $requestBody['properties'],
Please login to merge, or discard this patch.
src/Handlers/BaseHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
     protected function getFractal(): Manager
87 87
     {
88
-        if (!$this->fractal) {
88
+        if ( ! $this->fractal) {
89 89
             throw new InvalidStateException("Fractal manager isn't initialized. Did you call parent::__construct() in your handler constructor?");
90 90
         }
91 91
         return $this->fractal;
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
      */
128 128
     final public function createLink(array $params = []): string
129 129
     {
130
-        if (!$this->linkGenerator) {
130
+        if ( ! $this->linkGenerator) {
131 131
             throw new InvalidStateException('You have setupLinkGenerator for this handler if you want to generate link in this handler');
132 132
         }
133
-        if (!$this->endpoint) {
133
+        if ( ! $this->endpoint) {
134 134
             throw new InvalidStateException('You have setEndpoint() for this handler if you want to generate link in this handler');
135 135
         }
136 136
         $params = array_merge([
Please login to merge, or discard this patch.
src/Misc/ConsoleRequest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                     } elseif ($param->getType() === InputParam::TYPE_COOKIE) {
187 187
                         $cookieFields[$key][] = $valueData;
188 188
                     } else {
189
-                        $getFields[$key][] = urlencode((string)$valueData);
189
+                        $getFields[$key][] = urlencode((string) $valueData);
190 190
                     }
191 191
                 } else {
192 192
                     if (in_array($param->getType(), [InputParam::TYPE_POST, InputParam::TYPE_FILE], true)) {
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                     } elseif ($param->getType() === InputParam::TYPE_COOKIE) {
197 197
                         $cookieFields[$key] = $valueData;
198 198
                     } else {
199
-                        $getFields[$key] = urlencode((string)$valueData);
199
+                        $getFields[$key] = urlencode((string) $valueData);
200 200
                     }
201 201
                 }
202 202
             }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     {
245 245
         $result = [];
246 246
         foreach ($values as $key => $value) {
247
-            if (!is_array($value)) {
247
+            if ( ! is_array($value)) {
248 248
                 $result[$key] = $value;
249 249
                 continue;
250 250
             }
Please login to merge, or discard this patch.
src/ValidationResult/ValidationResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function __construct(string $status, array $errors = [])
23 23
     {
24
-        if (!in_array($status, [self::STATUS_OK, self::STATUS_ERROR], true)) {
24
+        if ( ! in_array($status, [self::STATUS_OK, self::STATUS_ERROR], true)) {
25 25
             throw new InvalidArgumentException($status . ' is not valid validation result status');
26 26
         }
27 27
 
Please login to merge, or discard this patch.
src/Params/GetInputParam.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 
11 11
     public function getValue(): mixed
12 12
     {
13
-        if (!filter_has_var(INPUT_GET, $this->key) && isset($_GET[$this->key])) {
13
+        if ( ! filter_has_var(INPUT_GET, $this->key) && isset($_GET[$this->key])) {
14 14
             return $_GET[$this->key];
15 15
         }
16 16
         $value = $this->isMulti() ? filter_input(INPUT_GET, $this->key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY) : filter_input(INPUT_GET, $this->key);
Please login to merge, or discard this patch.