Completed
Pull Request — master (#164)
by
unknown
13:40
created
src/Authorization/BasicAuthentication.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     {
31 31
         $urlScript = $this->httpRequest->getUrl();
32 32
         $authentication = $this->authentications[$urlScript->getUser()] ?? null;
33
-        if (!$authentication) {
33
+        if ( ! $authentication) {
34 34
             return false;
35 35
         }
36 36
 
Please login to merge, or discard this patch.
src/Component/ApiListingControl.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         $versionHandlers = [];
51 51
         foreach ($handlers as $handler) {
52 52
             $endPoint = $handler->getEndpoint();
53
-            if (!isset($versionHandlers[$endPoint->getVersion()])) {
53
+            if ( ! isset($versionHandlers[$endPoint->getVersion()])) {
54 54
                 $versionHandlers[$endPoint->getVersion()] = [];
55 55
             }
56 56
 
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::S401_Unauthorized] = [
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
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         foreach ($handler->params() as $param) {
510 510
             if ($param instanceof JsonInputParam) {
511 511
                 $schema = json_decode($param->getSchema(), true);
512
-                if (!empty($examples = $param->getExamples())) {
512
+                if ( ! empty($examples = $param->getExamples())) {
513 513
                     if (count($examples) === 1) {
514 514
                         $schema['example'] = is_array($param->getExample()) ? $param->getExample() : json_decode($param->getExample(), true);
515 515
                     } else {
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
                 $schema = [
530 530
                     'type' => 'string',
531 531
                 ];
532
-                if (!empty($examples = $param->getExamples())) {
532
+                if ( ! empty($examples = $param->getExamples())) {
533 533
                     if (count($examples) === 1) {
534 534
                         $schema['example'] = $param->getExample();
535 535
                     } else {
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             }
595 595
         }
596 596
 
597
-        if (!empty($requestBody['properties'])) {
597
+        if ( ! empty($requestBody['properties'])) {
598 598
             $requestBodySchema = [
599 599
                 'type' => 'object',
600 600
                 'properties' => $requestBody['properties'],
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 = 2 ** (32 - (int)$netmask) - 1;
113
+        $wildcard_decimal = 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
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 
53 53
     public function enableGlobalPreflight(?CorsPreflightHandlerInterface $corsHandler = null): void
54 54
     {
55
-        if (!$corsHandler) {
55
+        if ( ! $corsHandler) {
56 56
             $corsHandler = new CorsPreflightHandler(new Response());
57 57
         }
58 58
 
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
 
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
      */
126 126
     final public function createLink(array $params = []): string
127 127
     {
128
-        if (!$this->linkGenerator) {
128
+        if ( ! $this->linkGenerator) {
129 129
             throw new InvalidStateException('You have setupLinkGenerator for this handler if you want to generate link in this handler');
130 130
         }
131 131
 
132
-        if (!$this->endpoint) {
132
+        if ( ! $this->endpoint) {
133 133
             throw new InvalidStateException('You have setEndpoint() for this handler if you want to generate link in this handler');
134 134
         }
135 135
 
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
 
Please login to merge, or discard this patch.
src/Params/PostInputParam.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_POST, $this->key) && isset($_POST[$this->key])) {
13
+        if ( ! filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) {
14 14
             return $_POST[$this->key];
15 15
         }
16 16
 
Please login to merge, or discard this patch.
src/Params/CookieInputParam.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_COOKIE, $this->key) && isset($_COOKIE[$this->key])) {
13
+        if ( ! filter_has_var(INPUT_COOKIE, $this->key) && isset($_COOKIE[$this->key])) {
14 14
             return $_COOKIE[$this->key];
15 15
         }
16 16
 
Please login to merge, or discard this patch.