Completed
Push — master ( a2b4be...d107a0 )
by Neomerx
02:07
created
src/Api/Crud.php 1 patch
Spacing   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
                 assert(is_string($pathPiece));
723 723
                 $parent                    = $tmpPath;
724 724
                 $tmpPath                   = empty($tmpPath) === true ?
725
-                    $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece;
725
+                    $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece;
726 726
                 $normalizedPaths[$tmpPath] = [$parent, $pathPiece];
727 727
                 $pathsDepths[$parent]      = $parentDepth++;
728 728
             }
@@ -894,8 +894,7 @@  discard block
 block discarded – undo
894 894
             $filters = $this->getFilters();
895 895
             $sorts   = $this->getSorts();
896 896
             $this->areFiltersWithAnd() ?
897
-                $builder->addRelationshipFiltersAndSortsWithAnd($reverseRelName, $filters, $sorts) :
898
-                $builder->addRelationshipFiltersAndSortsWithOr($reverseRelName, $filters, $sorts);
897
+                $builder->addRelationshipFiltersAndSortsWithAnd($reverseRelName, $filters, $sorts) : $builder->addRelationshipFiltersAndSortsWithOr($reverseRelName, $filters, $sorts);
899 898
         }
900 899
         // ... and the input filters to actual data we select
901 900
         if ($relationshipFilters !== null) {
@@ -1014,7 +1013,7 @@  discard block
 block discarded – undo
1014 1013
 
1015 1014
         $this->clearFetchParameters();
1016 1015
 
1017
-        return (int)$deleted;
1016
+        return (int) $deleted;
1018 1017
     }
1019 1018
 
1020 1019
     /**
@@ -1028,7 +1027,7 @@  discard block
 block discarded – undo
1028 1027
 
1029 1028
         $this->clearFetchParameters();
1030 1029
 
1031
-        return (int)$deleted > 0;
1030
+        return (int) $deleted > 0;
1032 1031
     }
1033 1032
 
1034 1033
     /**
@@ -1049,7 +1048,7 @@  discard block
 block discarded – undo
1049 1048
 
1050 1049
         $this->clearBuilderParameters()->clearFetchParameters();
1051 1050
 
1052
-        $this->inTransaction(function () use ($saveMain, $toMany, &$index) {
1051
+        $this->inTransaction(function() use ($saveMain, $toMany, &$index) {
1053 1052
             $saveMain->execute();
1054 1053
 
1055 1054
             // if no index given will use last insert ID as index
@@ -1065,7 +1064,7 @@  discard block
 block discarded – undo
1065 1064
                         ->prepareCreateInToManyRelationship($relationshipName, $index, $secondaryIdBindName)
1066 1065
                 );
1067 1066
                 foreach ($secondaryIds as $secondaryId) {
1068
-                    $inserted += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
1067
+                    $inserted += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
1069 1068
                 }
1070 1069
             }
1071 1070
         });
@@ -1094,12 +1093,12 @@  discard block
 block discarded – undo
1094 1093
             ->createBuilder($this->getModelClass())
1095 1094
             ->updateModels($allowedChanges)
1096 1095
             ->addFiltersWithAndToTable($filters);
1097
-        $saveMain       = $this->builderSaveResourceOnUpdate($saveMain);
1096
+        $saveMain = $this->builderSaveResourceOnUpdate($saveMain);
1098 1097
         $saveMain->getSQL(); // prepare
1099 1098
 
1100 1099
         $this->clearBuilderParameters()->clearFetchParameters();
1101 1100
 
1102
-        $this->inTransaction(function () use ($saveMain, $toMany, $index, &$updated) {
1101
+        $this->inTransaction(function() use ($saveMain, $toMany, $index, &$updated) {
1103 1102
             $updated = $saveMain->execute();
1104 1103
 
1105 1104
             foreach ($toMany as $relationshipName => $secondaryIds) {
@@ -1119,12 +1118,12 @@  discard block
 block discarded – undo
1119 1118
                         ->prepareCreateInToManyRelationship($relationshipName, $index, $secondaryIdBindName)
1120 1119
                 );
1121 1120
                 foreach ($secondaryIds as $secondaryId) {
1122
-                    $updated += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
1121
+                    $updated += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
1123 1122
                 }
1124 1123
             }
1125 1124
         });
1126 1125
 
1127
-        return (int)$updated;
1126
+        return (int) $updated;
1128 1127
     }
1129 1128
 
1130 1129
     /**
@@ -1208,7 +1207,7 @@  discard block
 block discarded – undo
1208 1207
     /**
1209 1208
      * @inheritdoc
1210 1209
      */
1211
-    public function fetchRow(QueryBuilder $builder, string $modelClass): ?array
1210
+    public function fetchRow(QueryBuilder $builder, string $modelClass): ? array
1212 1211
     {
1213 1212
         $model = null;
1214 1213
 
@@ -1358,7 +1357,7 @@  discard block
 block discarded – undo
1358 1357
      *
1359 1358
      * @return iterable
1360 1359
      */
1361
-    protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable
1360
+    protected function filterAttributesOnCreate(?string $index, iterable $attributes) : iterable
1362 1361
     {
1363 1362
         if ($index !== null) {
1364 1363
             $pkName = $this->getModelSchemes()->getPrimaryKey($this->getModelClass());
@@ -1417,7 +1416,7 @@  discard block
 block discarded – undo
1417 1416
         $pkName = $this->getModelSchemes()->getPrimaryKey($parentClass);
1418 1417
 
1419 1418
         foreach ($childRelationships as $name) {
1420
-            $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name;
1419
+            $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name;
1421 1420
 
1422 1421
             $relationshipType = $this->getModelSchemes()->getRelationshipType($parentClass, $name);
1423 1422
             list ($targetModelClass, $reverseRelName) =
@@ -1438,7 +1437,7 @@  discard block
 block discarded – undo
1438 1437
                             [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]],
1439 1438
                             []
1440 1439
                         );
1441
-                        $child         = $deDup->register($this->fetchResourceWithoutRelationships(
1440
+                        $child = $deDup->register($this->fetchResourceWithoutRelationships(
1442 1441
                             $clonedBuilder,
1443 1442
                             $clonedBuilder->getModelClass()
1444 1443
                         ));
@@ -1459,7 +1458,7 @@  discard block
 block discarded – undo
1459 1458
                             [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]],
1460 1459
                             []
1461 1460
                         );
1462
-                        $children      = $this->fetchPaginatedResourcesWithoutRelationships(
1461
+                        $children = $this->fetchPaginatedResourcesWithoutRelationships(
1463 1462
                             $clonedBuilder,
1464 1463
                             $clonedBuilder->getModelClass()
1465 1464
                         );
Please login to merge, or discard this patch.