Completed
Push — master ( a43bb8...369074 )
by Neomerx
10:33
created
src/Validation/JsonApi/Rules/ToOneRelationshipTypeCheckerRule.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@
 block discarded – undo
62 62
         assert(is_scalar($index) === true && is_scalar($type) === true);
63 63
         $expectedType = $context->getProperties()->getProperty(static::PROPERTY_RESOURCE_TYPE);
64 64
         $reply        = $type === $expectedType ?
65
-            static::createSuccessReply($index) :
66
-            static::createErrorReply($context, $type, ErrorCodes::INVALID_RELATIONSHIP_TYPE);
65
+            static::createSuccessReply($index) : static::createErrorReply($context, $type, ErrorCodes::INVALID_RELATIONSHIP_TYPE);
67 66
 
68 67
         return $reply;
69 68
     }
Please login to merge, or discard this patch.
src/Validation/JsonApi/Execution/JsonApiQueryRulesSerializer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     private $serializedRules = [];
36 36
 
37 37
     /** Index key */
38
-    protected const IDENTITY_RULE= 0;
38
+    protected const IDENTITY_RULE = 0;
39 39
 
40 40
     /** Index key */
41 41
     protected const FILTER_RULES = self::IDENTITY_RULE + 1;
Please login to merge, or discard this patch.
src/Http/Traits/DefaultControllerMethodsTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
         $modelClass = $schemaClass::MODEL;
650 650
         assert($schemaInfo->hasRelationship($modelClass, $modelRelName));
651 651
         assert(
652
-            ($type =$schemaInfo->getRelationshipType($modelClass, $modelRelName)) === RelationshipTypes::BELONGS_TO ||
652
+            ($type = $schemaInfo->getRelationshipType($modelClass, $modelRelName)) === RelationshipTypes::BELONGS_TO ||
653 653
             $type === RelationshipTypes::BELONGS_TO_MANY
654 654
         );
655 655
 
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
      */
905 905
     private static function assertClassValueDefined(?string $value): void
906 906
     {
907
-        assert(empty($value) === false, 'Value should be defined in `' . static::class . '`.');
907
+        assert(empty($value) === false, 'Value should be defined in `'.static::class.'`.');
908 908
     }
909 909
 
910 910
     /**
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
     {
918 918
         assert(
919 919
             array_key_exists($interface, class_implements($class)) === true,
920
-            "Class `$class` should implement `" . $interface . '` interface.'
920
+            "Class `$class` should implement `".$interface.'` interface.'
921 921
         );
922 922
     }
923 923
 }
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);
@@ -364,7 +363,7 @@  discard block
 block discarded – undo
364 363
 
365 364
         if (count($this->getErrorAggregator()) > 0) {
366 365
             $title = $this->formatMessage(ErrorCodes::INVALID_VALUE);
367
-            $status  = JsonApiResponse::HTTP_CONFLICT;
366
+            $status = JsonApiResponse::HTTP_CONFLICT;
368 367
             foreach ($this->getErrorAggregator()->get() as $error) {
369 368
                 $details = $this->getMessage($error);
370 369
                 $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, $status);
@@ -459,7 +458,7 @@  discard block
 block discarded – undo
459 458
         $this->executeEnds($ends);
460 459
 
461 460
         if (count($this->getErrorAggregator()) > 0) {
462
-            $status  = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY;
461
+            $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY;
463 462
             foreach ($this->getErrorAggregator()->get() as $error) {
464 463
                 $this->getJsonApiErrorCollection()->addValidationAttributeError($error, $status);
465 464
             }
@@ -528,7 +527,7 @@  discard block
 block discarded – undo
528 527
         $this->executeEnds($ends);
529 528
 
530 529
         if (count($this->getErrorAggregator()) > 0) {
531
-            $status  = JsonApiResponse::HTTP_CONFLICT;
530
+            $status = JsonApiResponse::HTTP_CONFLICT;
532 531
             foreach ($this->getErrorAggregator()->get() as $error) {
533 532
                 $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status);
534 533
             }
Please login to merge, or discard this patch.
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 1 patch
Spacing   +10 added lines, -10 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,16 +419,16 @@  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 = $this->createRelationshipAlias($relationshipName);
426 426
 
427 427
         if ($relationshipFilters !== null) {
428
-            $addWith = $joinIndividuals === self::AND ? $this->expr()->andX() : $this->expr()->orX();
428
+            $addWith = $joinIndividuals === self:: AND ? $this->expr()->andX() : $this->expr()->orX();
429 429
             $this->applyFilters($addWith, $targetAlias, $relationshipFilters);
430 430
             if ($addWith->count() > 0) {
431
-                $joinRelationship === self::AND ? $this->andWhere($addWith) : $this->orWhere($addWith);
431
+                $joinRelationship === self:: AND ? $this->andWhere($addWith) : $this->orWhere($addWith);
432 432
             }
433 433
         }
434 434
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
             foreach ($operationsWithArgs as $operation => $arguments) {
552 552
                 assert(
553 553
                     is_iterable($arguments) === true || is_array($arguments) === true,
554
-                    "Operation arguments are missing for `$columnName` column. " .
554
+                    "Operation arguments are missing for `$columnName` column. ".
555 555
                     'Use an empty array as an empty argument list.'
556 556
                 );
557 557
                 $expression->add($this->createFilterExpression($fullColumnName, $operation, $arguments));
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
      */
587 587
     public function buildColumnName(string $table, string $column): string
588 588
     {
589
-        return $this->quoteTableName($table) . '.' . $this->quoteColumnName($column);
589
+        return $this->quoteTableName($table).'.'.$this->quoteColumnName($column);
590 590
     }
591 591
 
592 592
     /**
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
      */
629 629
     public function createAlias(string $tableName): string
630 630
     {
631
-        $alias                          = $tableName . (++$this->aliasIdCounter);
631
+        $alias                          = $tableName.(++$this->aliasIdCounter);
632 632
         $this->knownAliases[$tableName] = $alias;
633 633
 
634 634
         return $alias;
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
         string $targetColumn
683 683
     ): string {
684 684
         $targetAlias   = $this->createAlias($targetTable);
685
-        $joinCondition = $this->buildColumnName($fromAlias, $fromColumn) . '=' .
685
+        $joinCondition = $this->buildColumnName($fromAlias, $fromColumn).'='.
686 686
             $this->buildColumnName($targetAlias, $targetColumn);
687 687
 
688 688
         $this->innerJoin(
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
         } else {
881 881
             assert(
882 882
                 $value !== null,
883
-                'It seems you are trying to use `null` with =, >, <, or etc operator. ' .
883
+                'It seems you are trying to use `null` with =, >, <, or etc operator. '.
884 884
                 'Use `is null` or `not null` instead.'
885 885
             );
886 886
             assert(is_string($value), "Only strings, booleans and integers are supported.");
Please login to merge, or discard this patch.
src/Api/Crud.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             throw new InvalidArgumentException($this->getMessage(Messages::MSG_ERR_INVALID_ARGUMENT));
213 213
         }
214 214
 
215
-        assert(call_user_func(function () use ($indexes) {
215
+        assert(call_user_func(function() use ($indexes) {
216 216
             $allOk = true;
217 217
 
218 218
             foreach ($indexes as $index) {
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
             $classAtPath = new ArrayObject();
765 765
             $idsAtPath   = new ArrayObject();
766 766
 
767
-            $registerModelAtRoot = function ($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void {
767
+            $registerModelAtRoot = function($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void {
768 768
                 self::registerModelAtPath(
769 769
                     $model,
770 770
                     static::ROOT_PATH,
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
                 assert(is_string($pathPiece));
853 853
                 $parent                    = $tmpPath;
854 854
                 $tmpPath                   = empty($tmpPath) === true ?
855
-                    $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece;
855
+                    $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece;
856 856
                 $normalizedPaths[$tmpPath] = [$parent, $pathPiece];
857 857
                 $pathsDepths[$parent]      = $parentDepth++;
858 858
             }
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
     ): ModelQueryBuilder {
1022 1022
         assert(
1023 1023
             $this->getModelSchemas()->hasRelationship($this->getModelClass(), $relationshipName),
1024
-            "Relationship `$relationshipName` do not exist in model `" . $this->getModelClass() . '`'
1024
+            "Relationship `$relationshipName` do not exist in model `".$this->getModelClass().'`'
1025 1025
         );
1026 1026
 
1027 1027
         // as we read data from a relationship our main table and model would be the table/model in the relationship
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
         if ($this->hasFilters() === true) {
1040 1040
             $filters = $this->getFilters();
1041 1041
             $sorts   = $this->getSorts();
1042
-            $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder::AND : ModelQueryBuilder::OR;
1042
+            $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder:: AND : ModelQueryBuilder:: OR ;
1043 1043
             $builder->addRelationshipFiltersAndSorts($reverseRelName, $filters, $sorts, $joinCondition);
1044 1044
         }
1045 1045
         // ... and the input filters to actual data we select
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
     ) {
1071 1071
         assert(
1072 1072
             $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name),
1073
-            "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`'
1073
+            "Relationship `$name` do not exist in model `".$this->getModelClass().'`'
1074 1074
         );
1075 1075
 
1076 1076
         // depending on the relationship type we expect the result to be either single resource or a collection
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
     ): array {
1100 1100
         assert(
1101 1101
             $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name),
1102
-            "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`'
1102
+            "Relationship `$name` do not exist in model `".$this->getModelClass().'`'
1103 1103
         );
1104 1104
 
1105 1105
         // depending on the relationship type we expect the result to be either single resource or a collection
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
 
1176 1176
         $this->clearFetchParameters();
1177 1177
 
1178
-        return (int)$deleted;
1178
+        return (int) $deleted;
1179 1179
     }
1180 1180
 
1181 1181
     /**
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 
1192 1192
         $this->clearFetchParameters();
1193 1193
 
1194
-        return (int)$deleted > 0;
1194
+        return (int) $deleted > 0;
1195 1195
     }
1196 1196
 
1197 1197
     /**
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 
1217 1217
         $this->clearBuilderParameters()->clearFetchParameters();
1218 1218
 
1219
-        $this->inTransaction(function () use ($saveMain, $toMany, &$index) {
1219
+        $this->inTransaction(function() use ($saveMain, $toMany, &$index) {
1220 1220
             $saveMain->execute();
1221 1221
 
1222 1222
             // if no index given will use last insert ID as index
@@ -1257,12 +1257,12 @@  discard block
 block discarded – undo
1257 1257
             ->createBuilder($this->getModelClass())
1258 1258
             ->updateModels($allowedChanges)
1259 1259
             ->addFiltersWithAndToTable($filters);
1260
-        $saveMain       = $this->builderSaveResourceOnUpdate($saveMain);
1260
+        $saveMain = $this->builderSaveResourceOnUpdate($saveMain);
1261 1261
         $saveMain->getSQL(); // prepare
1262 1262
 
1263 1263
         $this->clearBuilderParameters()->clearFetchParameters();
1264 1264
 
1265
-        $this->inTransaction(function () use ($saveMain, $toMany, $index, &$updated) {
1265
+        $this->inTransaction(function() use ($saveMain, $toMany, $index, &$updated) {
1266 1266
             $updated = $saveMain->execute();
1267 1267
 
1268 1268
             $builderHook = Closure::fromCallable([$this, 'builderSaveRelationshipOnUpdate']);
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
                 )->execute();
1279 1279
 
1280 1280
                 // add new ones
1281
-                $updated   += $this->addInToManyRelationship(
1281
+                $updated += $this->addInToManyRelationship(
1282 1282
                     $connection,
1283 1283
                     $index,
1284 1284
                     $relationshipName,
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
             }
1289 1289
         });
1290 1290
 
1291
-        return (int)$updated;
1291
+        return (int) $updated;
1292 1292
     }
1293 1293
 
1294 1294
     /**
@@ -1303,9 +1303,9 @@  discard block
 block discarded – undo
1303 1303
     public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int
1304 1304
     {
1305 1305
         // Check that relationship is `BelongsToMany`
1306
-        assert(call_user_func(function () use ($name): bool {
1306
+        assert(call_user_func(function() use ($name): bool {
1307 1307
             $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name);
1308
-            $errMsg  = "Relationship `$name` of class `" . $this->getModelClass() .
1308
+            $errMsg  = "Relationship `$name` of class `".$this->getModelClass().
1309 1309
                 '` either is not `belongsToMany` or do not exist in the class.';
1310 1310
             $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY;
1311 1311
 
@@ -1327,9 +1327,9 @@  discard block
 block discarded – undo
1327 1327
     public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int
1328 1328
     {
1329 1329
         // Check that relationship is `BelongsToMany`
1330
-        assert(call_user_func(function () use ($name): bool {
1330
+        assert(call_user_func(function() use ($name): bool {
1331 1331
             $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name);
1332
-            $errMsg  = "Relationship `$name` of class `" . $this->getModelClass() .
1332
+            $errMsg  = "Relationship `$name` of class `".$this->getModelClass().
1333 1333
                 '` either is not `belongsToMany` or do not exist in the class.';
1334 1334
             $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY;
1335 1335
 
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
     {
1498 1498
         $countBuilder = $this->createBuilder($this->getModelClass());
1499 1499
         $countBuilder->setParameters($builder->getParameters());
1500
-        $countBuilder->select('COUNT(*)')->from('(' . $builder->getSQL() . ') AS RESULT');
1500
+        $countBuilder->select('COUNT(*)')->from('('.$builder->getSQL().') AS RESULT');
1501 1501
 
1502 1502
         return $countBuilder;
1503 1503
     }
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 
1530 1530
         foreach ($secondaryIdentities as $secondaryId) {
1531 1531
             try {
1532
-                $inserted += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
1532
+                $inserted += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
1533 1533
             } /** @noinspection PhpRedundantCatchClauseInspection */ catch (UcvException $exception) {
1534 1534
                 // Spec: If all of the specified resources can be added to, or are already present in,
1535 1535
                 // the relationship then the server MUST return a successful response.
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 
1777 1777
         $pkName = $this->getModelSchemas()->getPrimaryKey($parentClass);
1778 1778
 
1779
-        $registerModelAtPath = function ($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) {
1779
+        $registerModelAtPath = function($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) {
1780 1780
             return self::registerModelAtPath(
1781 1781
                 $model,
1782 1782
                 $path,
@@ -1788,7 +1788,7 @@  discard block
 block discarded – undo
1788 1788
         };
1789 1789
 
1790 1790
         foreach ($childRelationships as $name) {
1791
-            $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name;
1791
+            $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name;
1792 1792
 
1793 1793
             $relationshipType = $this->getModelSchemas()->getRelationshipType($parentClass, $name);
1794 1794
             list ($targetModelClass, $reverseRelName) =
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
                             [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]],
1844 1844
                             []
1845 1845
                         );
1846
-                        $children      = $this->fetchPaginatedResourcesWithoutRelationships(
1846
+                        $children = $this->fetchPaginatedResourcesWithoutRelationships(
1847 1847
                             $clonedBuilder,
1848 1848
                             $clonedBuilder->getModelClass()
1849 1849
                         );
Please login to merge, or discard this patch.