@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | // debug check all fields are strings |
94 | 94 | assert( |
95 | - (function () use ($fields) { |
|
95 | + (function() use ($fields) { |
|
96 | 96 | $allAreStrings = !empty($fields); |
97 | 97 | foreach ($fields as $field) { |
98 | 98 | $allAreStrings = $allAreStrings === true && is_string($field) === true && empty($field) === false; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | // debug check all fields are strings |
136 | 136 | assert( |
137 | - (function () use ($fields) { |
|
137 | + (function() use ($fields) { |
|
138 | 138 | $allAreStrings = !empty($fields); |
139 | 139 | foreach ($fields as $field) { |
140 | 140 | $allAreStrings = $allAreStrings === true && is_string($field) === true && empty($field) === false; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | // debug check all fields are strings |
178 | 178 | assert( |
179 | - (function () use ($paths) { |
|
179 | + (function() use ($paths) { |
|
180 | 180 | $allAreStrings = !empty($paths); |
181 | 181 | foreach ($paths as $path) { |
182 | 182 | $allAreStrings = $allAreStrings === true && is_string($path) === true && empty($path) === false; |
@@ -722,7 +722,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ); |
@@ -162,7 +162,7 @@ |
||
162 | 162 | protected function setWrapperErrors(array $wrapperErrors): self |
163 | 163 | { |
164 | 164 | if (empty($wrapperErrors) === false) { |
165 | - assert(call_user_func(function () use ($wrapperErrors) : bool { |
|
165 | + assert(call_user_func(function() use ($wrapperErrors) : bool { |
|
166 | 166 | $allAreErrors = true; |
167 | 167 | |
168 | 168 | foreach ($wrapperErrors as $error) { |
@@ -105,8 +105,7 @@ |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | $reply = $count > 0 ? |
108 | - BlockReplies::createSuccessReply($values) : |
|
109 | - BlockReplies::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
108 | + BlockReplies::createSuccessReply($values) : BlockReplies::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
110 | 109 | |
111 | 110 | return $reply; |
112 | 111 | } |
@@ -86,8 +86,7 @@ |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $reply = $foundInvalidType === null ? |
89 | - BlockReplies::createSuccessReply($indexes) : |
|
90 | - BlockReplies::createErrorReply($context, $foundInvalidType, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
89 | + BlockReplies::createSuccessReply($indexes) : BlockReplies::createErrorReply($context, $foundInvalidType, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
91 | 90 | |
92 | 91 | return $reply; |
93 | 92 | } |
@@ -77,8 +77,7 @@ |
||
77 | 77 | assert(is_scalar($index) === true && is_scalar($type) === true); |
78 | 78 | $expectedType = $context->getProperties()->getProperty(self::PROPERTY_RESOURCE_TYPE); |
79 | 79 | $reply = $type === $expectedType ? |
80 | - BlockReplies::createSuccessReply($index) : |
|
81 | - BlockReplies::createErrorReply($context, $type, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
80 | + BlockReplies::createSuccessReply($index) : BlockReplies::createErrorReply($context, $type, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
82 | 81 | |
83 | 82 | return $reply; |
84 | 83 | } |
@@ -101,8 +101,7 @@ |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $reply = $count <= 0 ? |
104 | - BlockReplies::createSuccessReply($value) : |
|
105 | - BlockReplies::createErrorReply($context, $value, ErrorCodes::UNIQUE_IN_DATABASE_SINGLE); |
|
104 | + BlockReplies::createSuccessReply($value) : BlockReplies::createErrorReply($context, $value, ErrorCodes::UNIQUE_IN_DATABASE_SINGLE); |
|
106 | 105 | |
107 | 106 | return $reply; |
108 | 107 | } |
@@ -101,8 +101,7 @@ |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $reply = $count > 0 ? |
104 | - BlockReplies::createSuccessReply($value) : |
|
105 | - BlockReplies::createErrorReply($context, $value, ErrorCodes::EXIST_IN_DATABASE_SINGLE); |
|
104 | + BlockReplies::createSuccessReply($value) : BlockReplies::createErrorReply($context, $value, ErrorCodes::EXIST_IN_DATABASE_SINGLE); |
|
106 | 105 | |
107 | 106 | return $reply; |
108 | 107 | } |
@@ -378,7 +378,7 @@ |
||
378 | 378 | /** |
379 | 379 | * @return int[]|null |
380 | 380 | */ |
381 | - private function getAttributeRules(): ?array |
|
381 | + private function getAttributeRules(): ? array |
|
382 | 382 | { |
383 | 383 | return $this->attributeRules; |
384 | 384 | } |