Completed
Push — master ( fe7948...dcfc04 )
by Neomerx
02:47
created
src/Schema/Schema.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -212,12 +212,12 @@
 block discarded – undo
212 212
             return [static::DATA => $data->getData()];
213 213
         }
214 214
 
215
-        $buildUrl = function ($offset) use ($data, $uri) {
215
+        $buildUrl = function($offset) use ($data, $uri) {
216 216
             $paramsWithPaging = [
217 217
                 JsonApiQueryParserInterface::PARAM_PAGING_OFFSET => $offset,
218 218
                 JsonApiQueryParserInterface::PARAM_PAGING_LIMIT  => $data->getLimit(),
219 219
             ];
220
-            $fullUrl          = $uri . '?' . http_build_query($paramsWithPaging);
220
+            $fullUrl = $uri.'?'.http_build_query($paramsWithPaging);
221 221
 
222 222
             return $fullUrl;
223 223
         };
Please login to merge, or discard this patch.
src/Http/Traits/FluteRoutesTrait.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
         assert(class_exists($controllerClass) === true);
49 49
 
50 50
         $groupPrefix = $group->getUriPrefix();
51
-        $indexSlug   = '/{' . JCI::ROUTE_KEY_INDEX . '}';
52
-        $params      = function (string $method) use ($groupPrefix, $resourceName): array {
51
+        $indexSlug   = '/{'.JCI::ROUTE_KEY_INDEX.'}';
52
+        $params      = function(string $method) use ($groupPrefix, $resourceName): array {
53 53
             return [RouteInterface::PARAM_NAME => static::routeName($groupPrefix, $resourceName, $method)];
54 54
         };
55
-        $handler     = function (string $method) use ($controllerClass): array {
55
+        $handler     = function(string $method) use ($controllerClass): array {
56 56
             return [$controllerClass, $method];
57 57
         };
58 58
 
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
             $group->post($resourceName, $handler(JCI::METHOD_CREATE), $params(JCI::METHOD_CREATE));
66 66
         }
67 67
         if (in_array(ControllerReadInterface::class, $classInterfaces) === true) {
68
-            $group->get($resourceName . $indexSlug, $handler(JCI::METHOD_READ), $params(JCI::METHOD_READ));
68
+            $group->get($resourceName.$indexSlug, $handler(JCI::METHOD_READ), $params(JCI::METHOD_READ));
69 69
         }
70 70
         if (in_array(ControllerUpdateInterface::class, $classInterfaces) === true) {
71
-            $group->patch($resourceName . $indexSlug, $handler(JCI::METHOD_UPDATE), $params(JCI::METHOD_UPDATE));
71
+            $group->patch($resourceName.$indexSlug, $handler(JCI::METHOD_UPDATE), $params(JCI::METHOD_UPDATE));
72 72
         }
73 73
         if (in_array(ControllerDeleteInterface::class, $classInterfaces) === true) {
74
-            $group->delete($resourceName . $indexSlug, $handler(JCI::METHOD_DELETE), $params(JCI::METHOD_DELETE));
74
+            $group->delete($resourceName.$indexSlug, $handler(JCI::METHOD_DELETE), $params(JCI::METHOD_DELETE));
75 75
         }
76 76
 
77 77
         return $group;
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
         }
98 98
 
99 99
         $groupPrefix = $group->getUriPrefix();
100
-        $slugged     = $subUri . '/{' . FCI::ROUTE_KEY_INDEX . '}';
101
-        $params      = function (string $method) use ($groupPrefix, $subUri) : array {
100
+        $slugged     = $subUri.'/{'.FCI::ROUTE_KEY_INDEX.'}';
101
+        $params      = function(string $method) use ($groupPrefix, $subUri) : array {
102 102
             return [RouteInterface::PARAM_NAME => static::routeName($groupPrefix, $subUri, $method)];
103 103
         };
104
-        $handler     = function (string $method) use ($controllerClass): array {
104
+        $handler     = function(string $method) use ($controllerClass): array {
105 105
             return [$controllerClass, $method];
106 106
         };
107 107
 
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
             $group->get($subUri, $handler(FCI::METHOD_INDEX), $params(FCI::METHOD_INDEX));
113 113
         }
114 114
         if (in_array(ControllerInstanceInterface::class, $classInterfaces) === true) {
115
-            $group->get($subUri . $createSubUrl, $handler(FCI::METHOD_INSTANCE), $params(FCI::METHOD_INSTANCE));
115
+            $group->get($subUri.$createSubUrl, $handler(FCI::METHOD_INSTANCE), $params(FCI::METHOD_INSTANCE));
116 116
         }
117 117
         if (in_array(ControllerCreateInterface::class, $classInterfaces) === true) {
118
-            $group->post($subUri . $createSubUrl, $handler(FCI::METHOD_CREATE), $params(FCI::METHOD_CREATE));
118
+            $group->post($subUri.$createSubUrl, $handler(FCI::METHOD_CREATE), $params(FCI::METHOD_CREATE));
119 119
         }
120 120
         if (in_array(ControllerReadInterface::class, $classInterfaces) === true) {
121 121
             $group->get($slugged, $handler(FCI::METHOD_READ), $params(FCI::METHOD_READ));
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             $group->post($slugged, $handler(FCI::METHOD_UPDATE), $params(FCI::METHOD_UPDATE));
125 125
         }
126 126
         if (in_array(ControllerDeleteInterface::class, $classInterfaces) === true) {
127
-            $deleteUri = $slugged . '/' . FCI::METHOD_DELETE;
127
+            $deleteUri = $slugged.'/'.FCI::METHOD_DELETE;
128 128
             $group->post($deleteUri, $handler(FCI::METHOD_DELETE), $params(FCI::METHOD_DELETE));
129 129
         }
130 130
 
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
         string $controllerClass,
148 148
         string $selfGetMethod
149 149
     ): GroupInterface {
150
-        $resourceIdUri = $resourceName . '/{' . JCI::ROUTE_KEY_INDEX . '}/';
151
-        $selfUri       = $resourceIdUri . DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName;
150
+        $resourceIdUri = $resourceName.'/{'.JCI::ROUTE_KEY_INDEX.'}/';
151
+        $selfUri       = $resourceIdUri.DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$relationshipName;
152 152
 
153 153
         return $group
154 154
             // `self`
155 155
             ->get($selfUri, [$controllerClass, $selfGetMethod])
156 156
             // `related`
157
-            ->get($resourceIdUri . $relationshipName, [$controllerClass, $selfGetMethod]);
157
+            ->get($resourceIdUri.$relationshipName, [$controllerClass, $selfGetMethod]);
158 158
     }
159 159
 
160 160
     /**
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
         string $controllerClass,
174 174
         string $addMethod
175 175
     ): GroupInterface {
176
-        $url = $resourceName . '/{' . JCI::ROUTE_KEY_INDEX . '}/' .
177
-            DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName;
176
+        $url = $resourceName.'/{'.JCI::ROUTE_KEY_INDEX.'}/'.
177
+            DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$relationshipName;
178 178
 
179 179
         return $group->post($url, [$controllerClass, $addMethod]);
180 180
     }
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
         string $controllerClass,
196 196
         string $deleteMethod
197 197
     ): GroupInterface {
198
-        $url = $resourceName . '/{' . JCI::ROUTE_KEY_INDEX . '}/' .
199
-            DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName;
198
+        $url = $resourceName.'/{'.JCI::ROUTE_KEY_INDEX.'}/'.
199
+            DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$relationshipName;
200 200
 
201 201
         return $group->delete($url, [$controllerClass, $deleteMethod]);
202 202
     }
@@ -222,6 +222,6 @@  discard block
 block discarded – undo
222 222
             $subUri = substr($subUri, 0, -1);
223 223
         }
224 224
 
225
-        return $prefix . $subUri . '::' . $method;
225
+        return $prefix.$subUri.'::'.$method;
226 226
     }
227 227
 }
Please login to merge, or discard this patch.
src/Encoder/Encoder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         parse_str($this->getOriginalUri()->getQuery(), $queryParams);
127 127
 
128
-        return function ($offset) use ($pageSize, $queryParams) {
128
+        return function($offset) use ($pageSize, $queryParams) {
129 129
             $paramsWithPaging = array_merge($queryParams, [
130 130
                 BaseQueryParserInterface::PARAM_PAGE => [
131 131
                     JsonApiQueryParserInterface::PARAM_PAGING_OFFSET => $offset,
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                 ],
134 134
             ]);
135 135
             $newUri           = $this->getOriginalUri()->withQuery(http_build_query($paramsWithPaging));
136
-            $fullUrl          = (string)$newUri;
136
+            $fullUrl          = (string) $newUri;
137 137
             $link             = $this->getFactory()->createLink($fullUrl, null, true);
138 138
 
139 139
             return $link;
Please login to merge, or discard this patch.
src/Adapters/ModelQueryBuilder.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     }
182 182
 
183 183
     /**
184
-     * @param iterable $attributes
184
+     * @param \Generator $attributes
185 185
      *
186 186
      * @return self
187 187
      *
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     }
204 204
 
205 205
     /**
206
-     * @param iterable $attributes
206
+     * @param \Generator $attributes
207 207
      *
208 208
      * @return self
209 209
      *
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      * @param string   $modelClass
227 227
      * @param iterable $attributes
228 228
      *
229
-     * @return iterable
229
+     * @return \Generator
230 230
      *
231 231
      * @SuppressWarnings(PHPMD.StaticAccess)
232 232
      *
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     }
358 358
 
359 359
     /**
360
-     * @param iterable $filters
360
+     * @param \Limoncello\Flute\Api\iterable|null $filters
361 361
      *
362 362
      * @return self
363 363
      *
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     }
374 374
 
375 375
     /**
376
-     * @param iterable $filters
376
+     * @param \Limoncello\Flute\Api\iterable|null $filters
377 377
      *
378 378
      * @return self
379 379
      *
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     }
390 390
 
391 391
     /**
392
-     * @param iterable $filters
392
+     * @param \Limoncello\Flute\Api\iterable|null $filters
393 393
      *
394 394
      * @return self
395 395
      *
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
     }
439 439
 
440 440
     /**
441
-     * @param iterable $sortParameters
441
+     * @param \Limoncello\Flute\Api\iterable|null $sortParameters
442 442
      *
443 443
      * @return self
444 444
      */
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     /**
49 49
      * Condition joining method.
50 50
      */
51
-    public const OR = self::AND + 1;
51
+    public const OR = self:: AND + 1;
52 52
 
53 53
     /**
54 54
      * @var string
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
         string $relationshipName,
420 420
         ?iterable $relationshipFilters,
421 421
         ?iterable $relationshipSorts,
422
-        int $joinIndividuals = self::AND,
423
-        int $joinRelationship = self::AND
422
+        int $joinIndividuals = self:: AND ,
423
+        int $joinRelationship = self:: AND
424 424
     ): self {
425 425
         $targetAlias = null;
426 426
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
             $reversePk = $isBelongsTo === true ?
433 433
                 $this->getModelSchemas()->getReversePrimaryKey($this->getModelClass(), $relationshipName)[0] : null;
434 434
 
435
-            $addWith = $joinIndividuals === self::AND ? $this->expr()->andX() : $this->expr()->orX();
435
+            $addWith = $joinIndividuals === self:: AND ? $this->expr()->andX() : $this->expr()->orX();
436 436
 
437 437
             foreach ($relationshipFilters as $columnName => $operationsWithArgs) {
438 438
                 if ($columnName === $reversePk) {
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
                 foreach ($operationsWithArgs as $operation => $arguments) {
452 452
                     assert(
453 453
                         is_iterable($arguments) === true || is_array($arguments) === true,
454
-                        "Operation arguments are missing for `$columnName` column. " .
454
+                        "Operation arguments are missing for `$columnName` column. ".
455 455
                         'Use an empty array as an empty argument list.'
456 456
                     );
457 457
                     $addWith->add($this->createFilterExpression($fullColumnName, $operation, $arguments));
458 458
                 }
459 459
 
460 460
                 if ($addWith->count() > 0) {
461
-                    $joinRelationship === self::AND ? $this->andWhere($addWith) : $this->orWhere($addWith);
461
+                    $joinRelationship === self:: AND ? $this->andWhere($addWith) : $this->orWhere($addWith);
462 462
                 }
463 463
             }
464 464
         }
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
             foreach ($operationsWithArgs as $operation => $arguments) {
593 593
                 assert(
594 594
                     is_iterable($arguments) === true || is_array($arguments) === true,
595
-                    "Operation arguments are missing for `$columnName` column. " .
595
+                    "Operation arguments are missing for `$columnName` column. ".
596 596
                     'Use an empty array as an empty argument list.'
597 597
                 );
598 598
                 $expression->add($this->createFilterExpression($fullColumnName, $operation, $arguments));
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
      */
628 628
     public function buildColumnName(string $table, string $column): string
629 629
     {
630
-        return $this->quoteTableName($table) . '.' . $this->quoteColumnName($column);
630
+        return $this->quoteTableName($table).'.'.$this->quoteColumnName($column);
631 631
     }
632 632
 
633 633
     /**
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
      */
670 670
     public function createAlias(string $tableName): string
671 671
     {
672
-        $alias                          = $tableName . (++$this->aliasIdCounter);
672
+        $alias                          = $tableName.(++$this->aliasIdCounter);
673 673
         $this->knownAliases[$tableName] = $alias;
674 674
 
675 675
         return $alias;
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
         string $targetColumn
724 724
     ): string {
725 725
         $targetAlias   = $this->createAlias($targetTable);
726
-        $joinCondition = $this->buildColumnName($fromAlias, $fromColumn) . '=' .
726
+        $joinCondition = $this->buildColumnName($fromAlias, $fromColumn).'='.
727 727
             $this->buildColumnName($targetAlias, $targetColumn);
728 728
 
729 729
         $this->innerJoin(
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
         } else {
922 922
             assert(
923 923
                 $value !== null,
924
-                'It seems you are trying to use `null` with =, >, <, or etc operator. ' .
924
+                'It seems you are trying to use `null` with =, >, <, or etc operator. '.
925 925
                 'Use `is null` or `not null` instead.'
926 926
             );
927 927
             assert(is_string($value), "Only strings, booleans and integers are supported.");
Please login to merge, or discard this patch.
src/Validation/JsonApi/Rules/AreReadableViaApiRule.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,6 @@
 block discarded – undo
82 82
         }
83 83
 
84 84
         return $result === true ?
85
-            static::createSuccessReply($values) :
86
-            static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE);
85
+            static::createSuccessReply($values) : static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE);
87 86
     }
88 87
 }
Please login to merge, or discard this patch.
src/Validation/JsonApi/Rules/ExistInDbTableMultipleWithDoctrineRule.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,13 +83,12 @@
 block discarded – undo
83 83
                 ->where($builder->expr()->in($primaryName, $placeholders))
84 84
                 ->execute();
85 85
 
86
-            $count  = (int)$statement->fetchColumn();
86
+            $count  = (int) $statement->fetchColumn();
87 87
             $result = $count === count($values);
88 88
         }
89 89
 
90 90
         $reply = $result === true ?
91
-            static::createSuccessReply($values) :
92
-            static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE);
91
+            static::createSuccessReply($values) : static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE);
93 92
 
94 93
         return $reply;
95 94
     }
Please login to merge, or discard this patch.
src/Validation/JsonApi/DataParser.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -242,12 +242,11 @@  discard block
 block discarded – undo
242 242
             $this->executeStarts($this->getSerializer()::readRuleStartIndexes($ruleIndexes));
243 243
             $ruleIndex = $this->getSerializer()::readRuleIndex($ruleIndexes);
244 244
             $isFoundInToOne === true ?
245
-                $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) :
246
-                $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData);
245
+                $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) : $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData);
247 246
             $this->executeEnds($this->getSerializer()::readRuleEndIndexes($ruleIndexes));
248 247
 
249 248
             if (count($this->getErrorAggregator()) > 0) {
250
-                $status  = JsonApiResponse::HTTP_CONFLICT;
249
+                $status = JsonApiResponse::HTTP_CONFLICT;
251 250
                 foreach ($this->getErrorAggregator()->get() as $error) {
252 251
                     $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status);
253 252
                     $this->addErrorStatus($status);
@@ -362,7 +361,7 @@  discard block
 block discarded – undo
362 361
 
363 362
         if (count($this->getErrorAggregator()) > 0) {
364 363
             $title = $this->formatMessage(ErrorCodes::INVALID_VALUE);
365
-            $status  = JsonApiResponse::HTTP_CONFLICT;
364
+            $status = JsonApiResponse::HTTP_CONFLICT;
366 365
             foreach ($this->getErrorAggregator()->get() as $error) {
367 366
                 $details = $this->getMessage($error);
368 367
                 $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, $status);
@@ -453,7 +452,7 @@  discard block
 block discarded – undo
453 452
         $this->executeEnds($this->getSerializer()::readRulesEndIndexes($this->getAttributeRules()));
454 453
 
455 454
         if (count($this->getErrorAggregator()) > 0) {
456
-            $status  = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY;
455
+            $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY;
457 456
             foreach ($this->getErrorAggregator()->get() as $error) {
458 457
                 $this->getJsonApiErrorCollection()->addValidationAttributeError($error, $status);
459 458
             }
@@ -520,7 +519,7 @@  discard block
 block discarded – undo
520 519
         ));
521 520
 
522 521
         if (count($this->getErrorAggregator()) > 0) {
523
-            $status  = JsonApiResponse::HTTP_CONFLICT;
522
+            $status = JsonApiResponse::HTTP_CONFLICT;
524 523
             foreach ($this->getErrorAggregator()->get() as $error) {
525 524
                 $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status);
526 525
             }
Please login to merge, or discard this patch.