Completed
Push — develop ( ec64f2...9148fa )
by Neomerx
02:26
created
src/Api/Crud.php 1 patch
Spacing   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
                 assert(is_string($pathPiece));
636 636
                 $parent                    = $tmpPath;
637 637
                 $tmpPath                   = empty($tmpPath) === true ?
638
-                    $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece;
638
+                    $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece;
639 639
                 $normalizedPaths[$tmpPath] = [$parent, $pathPiece];
640 640
                 $pathsDepths[$parent]      = $parentDepth++;
641 641
             }
@@ -772,8 +772,7 @@  discard block
 block discarded – undo
772 772
             $filters = $this->getFilters();
773 773
             $sorts   = $this->getSorts();
774 774
             $this->areFiltersWithAnd() ?
775
-                $builder->addRelationshipFiltersAndSortsWithAnd($reverseRelName, $filters, $sorts) :
776
-                $builder->addRelationshipFiltersAndSortsWithOr($reverseRelName, $filters, $sorts);
775
+                $builder->addRelationshipFiltersAndSortsWithAnd($reverseRelName, $filters, $sorts) : $builder->addRelationshipFiltersAndSortsWithOr($reverseRelName, $filters, $sorts);
777 776
         }
778 777
         // ... and the input filters to actual data we select
779 778
         if ($relationshipFilters !== null) {
@@ -851,7 +850,7 @@  discard block
 block discarded – undo
851 850
 
852 851
         $this->clearFetchParameters();
853 852
 
854
-        return (int)$deleted;
853
+        return (int) $deleted;
855 854
     }
856 855
 
857 856
     /**
@@ -872,7 +871,7 @@  discard block
 block discarded – undo
872 871
 
873 872
         $this->clearBuilderParameters()->clearFetchParameters();
874 873
 
875
-        $this->inTransaction($saveMain->getConnection(), function () use ($saveMain, $toMany, &$index) {
874
+        $this->inTransaction($saveMain->getConnection(), function() use ($saveMain, $toMany, &$index) {
876 875
             $saveMain->execute();
877 876
 
878 877
             // if no index given will use last insert ID as index
@@ -888,7 +887,7 @@  discard block
 block discarded – undo
888 887
                         ->prepareCreateInToManyRelationship($relationshipName, $index, $secondaryIdBindName)
889 888
                 );
890 889
                 foreach ($secondaryIds as $secondaryId) {
891
-                    $inserted += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
890
+                    $inserted += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
892 891
                 }
893 892
             }
894 893
         });
@@ -917,12 +916,12 @@  discard block
 block discarded – undo
917 916
             ->createBuilder($this->getModelClass())
918 917
             ->updateModels($allowedChanges)
919 918
             ->addFiltersWithAndToTable($filters);
920
-        $saveMain       = $this->builderSaveResourceOnUpdate($saveMain);
919
+        $saveMain = $this->builderSaveResourceOnUpdate($saveMain);
921 920
         $saveMain->getSQL(); // prepare
922 921
 
923 922
         $this->clearBuilderParameters()->clearFetchParameters();
924 923
 
925
-        $this->inTransaction($saveMain->getConnection(), function () use ($saveMain, $toMany, $index, &$updated) {
924
+        $this->inTransaction($saveMain->getConnection(), function() use ($saveMain, $toMany, $index, &$updated) {
926 925
             $updated = $saveMain->execute();
927 926
 
928 927
             foreach ($toMany as $relationshipName => $secondaryIds) {
@@ -942,12 +941,12 @@  discard block
 block discarded – undo
942 941
                         ->prepareCreateInToManyRelationship($relationshipName, $index, $secondaryIdBindName)
943 942
                 );
944 943
                 foreach ($secondaryIds as $secondaryId) {
945
-                    $updated += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
944
+                    $updated += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
946 945
                 }
947 946
             }
948 947
         });
949 948
 
950
-        return (int)$updated;
949
+        return (int) $updated;
951 950
     }
952 951
 
953 952
     /**
@@ -1050,7 +1049,7 @@  discard block
 block discarded – undo
1050 1049
     public function fetchRow(
1051 1050
         QueryBuilder $builder = null,
1052 1051
         string $modelClass = null
1053
-    ): ?array {
1052
+    ): ? array {
1054 1053
         if ($builder === null && $modelClass === null) {
1055 1054
             $builder    = $this->getIndexModelBuilder();
1056 1055
             $modelClass = $builder->getModelClass();
@@ -1151,7 +1150,7 @@  discard block
 block discarded – undo
1151 1150
      *
1152 1151
      * @return iterable
1153 1152
      */
1154
-    protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable
1153
+    protected function filterAttributesOnCreate(?string $index, iterable $attributes) : iterable
1155 1154
     {
1156 1155
         if ($index !== null) {
1157 1156
             $pkName = $this->getModelSchemes()->getPrimaryKey($this->getModelClass());
@@ -1210,7 +1209,7 @@  discard block
 block discarded – undo
1210 1209
         $pkName = $this->getModelSchemes()->getPrimaryKey($parentClass);
1211 1210
 
1212 1211
         foreach ($childRelationships as $name) {
1213
-            $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name;
1212
+            $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name;
1214 1213
 
1215 1214
             $relationshipType = $this->getModelSchemes()->getRelationshipType($parentClass, $name);
1216 1215
             list ($targetModelClass, $reverseRelName) =
@@ -1231,7 +1230,7 @@  discard block
 block discarded – undo
1231 1230
                             [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]],
1232 1231
                             []
1233 1232
                         );
1234
-                        $child         = $deDup->register($this->fetchResourceWithoutRelationships(
1233
+                        $child = $deDup->register($this->fetchResourceWithoutRelationships(
1235 1234
                             $clonedBuilder,
1236 1235
                             $clonedBuilder->getModelClass()
1237 1236
                         ));
@@ -1252,7 +1251,7 @@  discard block
 block discarded – undo
1252 1251
                             [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]],
1253 1252
                             []
1254 1253
                         );
1255
-                        $children      = $this->fetchPaginatedResourcesWithoutRelationships(
1254
+                        $children = $this->fetchPaginatedResourcesWithoutRelationships(
1256 1255
                             $clonedBuilder,
1257 1256
                             $clonedBuilder->getModelClass()
1258 1257
                         );
Please login to merge, or discard this patch.
src/Http/BaseController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         ContainerInterface $container,
139 139
         ServerRequestInterface $request
140 140
     ): ResponseInterface {
141
-        $jsonData  = static::normalizeIndexValueOnUpdate(
141
+        $jsonData = static::normalizeIndexValueOnUpdate(
142 142
             $routeParams,
143 143
             $container,
144 144
             static::readJsonFromRequest($container, $request)
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      */
236 236
     protected static function readJsonFromRequest(ContainerInterface $container, ServerRequestInterface $request): array
237 237
     {
238
-        $body = (string)$request->getBody();
238
+        $body = (string) $request->getBody();
239 239
         if (empty($body) === true || ($json = json_decode($body, true)) === null) {
240 240
             /** @var FactoryInterface $factory */
241 241
             $factory = $container->get(FactoryInterface::class);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     {
366 366
         assert(
367 367
             empty(static::ON_CREATE_VALIDATION_RULES_SET_CLASS) === false,
368
-            'Validation rules set should be defined for class ' . static::class . '.'
368
+            'Validation rules set should be defined for class '.static::class.'.'
369 369
         );
370 370
 
371 371
         return static::createJsonApiValidator($container, static::ON_CREATE_VALIDATION_RULES_SET_CLASS);
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     {
381 381
         assert(
382 382
             empty(static::ON_UPDATE_VALIDATION_RULES_SET_CLASS) === false,
383
-            'Validation rules set should be defined for class ' . static::class . '.'
383
+            'Validation rules set should be defined for class '.static::class.'.'
384 384
         );
385 385
 
386 386
         return static::createJsonApiValidator($container, static::ON_UPDATE_VALIDATION_RULES_SET_CLASS);
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
         $mapper = static::createParameterMapper($container);
520 520
         $api    = static::createApi($container);
521 521
 
522
-        $relData    = $mapper->applyQueryParameters($parser, $api)
522
+        $relData = $mapper->applyQueryParameters($parser, $api)
523 523
             ->withFilters([$modelClass::FIELD_ID => [FilterParameterInterface::OPERATION_EQUALS => [$index]]])
524 524
             ->readRelationship($relationshipName);
525 525
 
Please login to merge, or discard this patch.
src/Http/Query/ParametersMapper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     public function getMappedIncludes(): iterable
246 246
     {
247 247
         $fromScheme        = $this->getRootScheme();
248
-        $getMappedRelLinks = function (iterable $links) use ($fromScheme) : iterable {
248
+        $getMappedRelLinks = function(iterable $links) use ($fromScheme) : iterable {
249 249
             foreach ($links as $link) {
250 250
                 assert(is_string($link));
251 251
                 $fromSchemaClass = get_class($fromScheme);
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
         //     ['rel2_name1', ],
290 290
         //     ['rel3_name1', 'rel3_name2', 'rel3_name3', ],
291 291
         // ]
292
-        $includeAsModelNames = function (iterable $relationships): iterable {
292
+        $includeAsModelNames = function(iterable $relationships): iterable {
293 293
             foreach ($relationships as $relationship) {
294 294
                 assert($relationship instanceof RelationshipInterface);
295 295
                 yield $relationship->getNameInModel();
296 296
             }
297 297
         };
298
-        $mappedIncludes     = $this->getMappedIncludes();
299
-        $getIncludes         = function () use ($mappedIncludes, $includeAsModelNames) : iterable {
298
+        $mappedIncludes = $this->getMappedIncludes();
299
+        $getIncludes = function() use ($mappedIncludes, $includeAsModelNames) : iterable {
300 300
             foreach ($mappedIncludes as $relationships) {
301 301
                 yield $includeAsModelNames($relationships);
302 302
             }
Please login to merge, or discard this patch.
src/Http/Query/BaseQueryParser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     public function __construct(array $parameters = [], array $messages = null)
49 49
     {
50 50
         $this->setParameters($parameters);
51
-        $this->messages   = $messages;
51
+        $this->messages = $messages;
52 52
     }
53 53
 
54 54
     /**
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
     public function getIncludes(): iterable
70 70
     {
71 71
         if (array_key_exists(static::PARAM_INCLUDE, $this->getParameters()) === true) {
72
-            $splitByDot = function (string $path): iterable {
72
+            $splitByDot = function(string $path): iterable {
73 73
                 foreach ($this->splitStringAndCheckNoEmpties(static::PARAM_INCLUDE, $path, '.') as $link) {
74 74
                     yield $link;
75 75
                 }
76 76
             };
77 77
 
78
-            $includes   = $this->getParameters()[static::PARAM_INCLUDE];
78
+            $includes = $this->getParameters()[static::PARAM_INCLUDE];
79 79
             foreach ($this->splitCommaSeparatedStringAndCheckNoEmpties(static::PARAM_INCLUDE, $includes) as $path) {
80 80
                 yield $path => $splitByDot($path);
81 81
             }
Please login to merge, or discard this patch.
src/Contracts/Api/CrudInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
      *
119 119
      * @return array|null
120 120
      */
121
-    public function fetchRow(QueryBuilder $builder = null, string $modelClass = null): ?array;
121
+    public function fetchRow(QueryBuilder $builder = null, string $modelClass = null): ? array;
122 122
 
123 123
     /**
124 124
      * @return PaginatedDataInterface
Please login to merge, or discard this patch.
src/Package/FluteContainerConfigurator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,22 +49,22 @@  discard block
 block discarded – undo
49 49
 
50 50
         $container[FactoryInterface::class] = $factory;
51 51
 
52
-        $container[JsonSchemesInterface::class] = function (PsrContainerInterface $container) use ($factory) {
52
+        $container[JsonSchemesInterface::class] = function(PsrContainerInterface $container) use ($factory) {
53 53
             $settings     = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);
54 54
             $modelSchemes = $container->get(ModelSchemeInfoInterface::class);
55 55
 
56 56
             return $factory->createJsonSchemes($settings[FluteSettings::KEY_MODEL_TO_SCHEME_MAP], $modelSchemes);
57 57
         };
58 58
 
59
-        $container[QueryParserInterface::class] = function (PsrContainerInterface $container) {
59
+        $container[QueryParserInterface::class] = function(PsrContainerInterface $container) {
60 60
             return new QueryParser($container->get(PaginationStrategyInterface::class));
61 61
         };
62 62
 
63
-        $container[ParametersMapperInterface::class] = function (PsrContainerInterface $container) {
63
+        $container[ParametersMapperInterface::class] = function(PsrContainerInterface $container) {
64 64
             return new ParametersMapper($container->get(JsonSchemesInterface::class));
65 65
         };
66 66
 
67
-        $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) {
67
+        $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) {
68 68
             /** @var JsonSchemesInterface $jsonSchemes */
69 69
             $jsonSchemes = $container->get(JsonSchemesInterface::class);
70 70
             $settings    = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             return $encoder;
80 80
         };
81 81
 
82
-        $container[PaginationStrategyInterface::class] = function (PsrContainerInterface $container) {
82
+        $container[PaginationStrategyInterface::class] = function(PsrContainerInterface $container) {
83 83
             $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);
84 84
 
85 85
             return new PaginationStrategy(
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             );
89 89
         };
90 90
 
91
-        $container[JsonApiValidatorFactoryInterface::class] = function (PsrContainerInterface $container) {
91
+        $container[JsonApiValidatorFactoryInterface::class] = function(PsrContainerInterface $container) {
92 92
             $factory = new JsonApiValidatorFactory($container);
93 93
 
94 94
             return $factory;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public static function configureExceptionHandler(LimoncelloContainerInterface $container)
118 118
     {
119
-        $container[ThrowableHandlerInterface::class] = function (PsrContainerInterface $container) {
119
+        $container[ThrowableHandlerInterface::class] = function(PsrContainerInterface $container) {
120 120
             $appSettings   = $container->get(SettingsProviderInterface::class)->get(A::class);
121 121
             $fluteSettings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);
122 122
 
Please login to merge, or discard this patch.
src/Adapters/ModelQueryBuilder.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         string $relationshipName,
275 275
         iterable $relationshipFilters,
276 276
         ?iterable $relationshipSorts
277
-    ): self {
277
+    ) : self {
278 278
         $joinWith = $this->expr()->andX();
279 279
 
280 280
         return $this->addRelationshipFiltersAndSorts(
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         string $relationshipName,
309 309
         iterable $relationshipFilters,
310 310
         ?iterable $relationshipSorts
311
-    ): self {
311
+    ) : self {
312 312
         $joinWith = $this->expr()->orX();
313 313
 
314 314
         return $this->addRelationshipFiltersAndSorts(
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         CompositeExpression $filterLink,
372 372
         iterable $relationshipFilters,
373 373
         ?iterable $relationshipSorts
374
-    ): self {
374
+    ) : self {
375 375
         $relationshipType = $this->getModelSchemes()->getRelationshipType($this->getModelClass(), $relationshipName);
376 376
         switch ($relationshipType) {
377 377
             case RelationshipTypes::BELONGS_TO:
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
         CompositeExpression $filterLink,
445 445
         iterable $relationshipFilters,
446 446
         ?iterable $relationshipSorts
447
-    ): self {
447
+    ) : self {
448 448
         $foreignKey = $this->getModelSchemes()->getForeignKey($this->getModelClass(), $relationshipName);
449 449
         list($onePrimaryKey, $oneTable) =
450 450
             $this->getModelSchemes()->getReversePrimaryKey($this->getModelClass(), $relationshipName);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
         CompositeExpression $filterLink,
477 477
         iterable $relationshipFilters,
478 478
         ?iterable $relationshipSorts
479
-    ): self {
479
+    ) : self {
480 480
         $primaryKey = $this->getModelSchemes()->getPrimaryKey($this->getModelClass());
481 481
         list($manyForeignKey, $manyTable) =
482 482
             $this->getModelSchemes()->getReverseForeignKey($this->getModelClass(), $relationshipName);
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
         CompositeExpression $targetFilterLink,
509 509
         iterable $relationshipFilters,
510 510
         ?iterable $relationshipSorts
511
-    ): self {
511
+    ) : self {
512 512
         $primaryKey = $this->getModelSchemes()->getPrimaryKey($this->getModelClass());
513 513
         list ($intermediateTable, $intermediatePk, $intermediateFk) =
514 514
             $this->getModelSchemes()->getBelongsToManyRelationship($this->getModelClass(), $relationshipName);
@@ -556,9 +556,9 @@  discard block
 block discarded – undo
556 556
         ?CompositeExpression $targetFilterLink,
557 557
         ?iterable $targetFilterParams,
558 558
         ?iterable $relationshipSorts
559
-    ): string {
559
+    ) : string {
560 560
         $targetAlias   = $this->createAlias($targetTable);
561
-        $joinCondition = $this->buildColumnName($fromAlias, $fromColumn) . '=' .
561
+        $joinCondition = $this->buildColumnName($fromAlias, $fromColumn).'='.
562 562
             $this->buildColumnName($targetAlias, $targetColumn);
563 563
 
564 564
         $this->innerJoin(
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
         ?CompositeExpression $targetFilterLink,
618 618
         ?iterable $targetFilterParams,
619 619
         ?iterable $targetSortParams
620
-    ): string {
620
+    ) : string {
621 621
         $intNoSorting = null;
622 622
         $intAlias     = $this->innerJoinOneTable(
623 623
             $fromAlias,
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
             $intFilterParams,
629 629
             $intNoSorting
630 630
         );
631
-        $targetAlias  = $this->innerJoinOneTable(
631
+        $targetAlias = $this->innerJoinOneTable(
632 632
             $intAlias,
633 633
             $intToTargetColumn,
634 634
             $targetTable,
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
      */
649 649
     private function createAlias(string $tableName): string
650 650
     {
651
-        $alias                          = $tableName . (++$this->aliasIdCounter);
651
+        $alias                          = $tableName.(++$this->aliasIdCounter);
652 652
         $this->knownAliases[$tableName] = $alias;
653 653
 
654 654
         return $alias;
Please login to merge, or discard this patch.