Completed
Push — master ( ee198e...323919 )
by Neomerx
02:19
created
src/Adapters/ModelQueryBuilder.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare (strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Limoncello\Flute\Adapters;
4 4
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     /**
51 51
      * Condition joining method.
52 52
      */
53
-    public const OR = self::AND + 1;
53
+    public const OR = self:: AND + 1;
54 54
 
55 55
     /**
56 56
      * @var string
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
         string $relationshipName,
466 466
         ?iterable $relationshipFilters,
467 467
         ?iterable $relationshipSorts,
468
-        int $joinIndividuals = self::AND,
469
-        int $joinRelationship = self::AND
468
+        int $joinIndividuals = self:: AND ,
469
+        int $joinRelationship = self:: AND
470 470
     ): self {
471 471
         $targetAlias = null;
472 472
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             $reversePk = $isBelongsTo === true ?
479 479
                 $this->getModelSchemas()->getReversePrimaryKey($this->getModelClass(), $relationshipName)[0] : null;
480 480
 
481
-            $addWith = $joinIndividuals === self::AND ? $this->expr()->andX() : $this->expr()->orX();
481
+            $addWith = $joinIndividuals === self:: AND ? $this->expr()->andX() : $this->expr()->orX();
482 482
 
483 483
             foreach ($relationshipFilters as $columnName => $operationsWithArgs) {
484 484
                 if ($columnName === $reversePk) {
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
                 foreach ($operationsWithArgs as $operation => $arguments) {
499 499
                     assert(
500 500
                         is_iterable($arguments) === true || is_array($arguments) === true,
501
-                        "Operation arguments are missing for `$columnName` column. " .
501
+                        "Operation arguments are missing for `$columnName` column. ".
502 502
                         'Use an empty array as an empty argument list.'
503 503
                     );
504 504
                     $addWith->add($this->createFilterExpression($fullColumnName, $operation, $arguments));
505 505
                 }
506 506
 
507 507
                 if ($addWith->count() > 0) {
508
-                    $joinRelationship === self::AND ? $this->andWhere($addWith) : $this->orWhere($addWith);
508
+                    $joinRelationship === self:: AND ? $this->andWhere($addWith) : $this->orWhere($addWith);
509 509
                 }
510 510
             }
511 511
         }
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
             foreach ($operationsWithArgs as $operation => $arguments) {
647 647
                 assert(
648 648
                     is_iterable($arguments) === true || is_array($arguments) === true,
649
-                    "Operation arguments are missing for `$columnName` column. " .
649
+                    "Operation arguments are missing for `$columnName` column. ".
650 650
                     'Use an empty array as an empty argument list.'
651 651
                 );
652 652
                 $expression->add($this->createFilterExpression($fullColumnName, $operation, $arguments));
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
     {
700 700
         $platform = $this->getConnection()->getDatabasePlatform();
701 701
 
702
-        return $platform->quoteSingleIdentifier($tableOrAlias) . '.' . $platform->quoteSingleIdentifier($column);
702
+        return $platform->quoteSingleIdentifier($tableOrAlias).'.'.$platform->quoteSingleIdentifier($column);
703 703
     }
704 704
 
705 705
     /**
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
      */
742 742
     public function createAlias(string $tableName): string
743 743
     {
744
-        $alias                          = $tableName . (++$this->aliasIdCounter);
744
+        $alias                          = $tableName.(++$this->aliasIdCounter);
745 745
         $this->knownAliases[$tableName] = $alias;
746 746
 
747 747
         return $alias;
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
         string $targetColumn
765 765
     ): string {
766 766
         $targetAlias   = $this->createAlias($targetTable);
767
-        $joinCondition = $this->quoteDoubleIdentifier($fromAlias, $fromColumn) . '=' .
767
+        $joinCondition = $this->quoteDoubleIdentifier($fromAlias, $fromColumn).'='.
768 768
             $this->quoteDoubleIdentifier($targetAlias, $targetColumn);
769 769
 
770 770
         $this->innerJoin(
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
         } else {
978 978
             assert(
979 979
                 $value !== null,
980
-                'It seems you are trying to use `null` with =, >, <, or etc operator. ' .
980
+                'It seems you are trying to use `null` with =, >, <, or etc operator. '.
981 981
                 'Use `is null` or `not null` instead.'
982 982
             );
983 983
             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   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare (strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Limoncello\Flute\Api;
4 4
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             throw new InvalidArgumentException($this->getMessage(Messages::MSG_ERR_INVALID_ARGUMENT));
210 210
         }
211 211
 
212
-        assert(call_user_func(function () use ($indexes) {
212
+        assert(call_user_func(function() use ($indexes) {
213 213
             $allOk = true;
214 214
 
215 215
             foreach ($indexes as $index) {
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
             $classAtPath = new ArrayObject();
764 764
             $idsAtPath   = new ArrayObject();
765 765
 
766
-            $registerModelAtRoot = function ($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void {
766
+            $registerModelAtRoot = function($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void {
767 767
                 self::registerModelAtPath(
768 768
                     $model,
769 769
                     static::ROOT_PATH,
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
                 assert(is_string($pathPiece));
852 852
                 $parent                    = $tmpPath;
853 853
                 $tmpPath                   = empty($tmpPath) === true ?
854
-                    $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece;
854
+                    $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece;
855 855
                 $normalizedPaths[$tmpPath] = [$parent, $pathPiece];
856 856
                 $pathsDepths[$parent]      = $parentDepth++;
857 857
             }
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
             $this->createCountBuilderFromBuilder($this->createIndexModelBuilder())
1000 1000
         )->execute()->fetchColumn();
1001 1001
 
1002
-        return $result === false ? null : (int)$result;
1002
+        return $result === false ? null : (int) $result;
1003 1003
     }
1004 1004
 
1005 1005
     /**
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
     ): ModelQueryBuilder {
1021 1021
         assert(
1022 1022
             $this->getModelSchemas()->hasRelationship($this->getModelClass(), $relationshipName),
1023
-            "Relationship `$relationshipName` do not exist in model `" . $this->getModelClass() . '`'
1023
+            "Relationship `$relationshipName` do not exist in model `".$this->getModelClass().'`'
1024 1024
         );
1025 1025
 
1026 1026
         // as we read data from a relationship our main table and model would be the table/model in the relationship
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
         if ($this->hasFilters() === true) {
1039 1039
             $filters = $this->getFilters();
1040 1040
             $sorts   = $this->getSorts();
1041
-            $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder::AND : ModelQueryBuilder::OR;
1041
+            $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder:: AND : ModelQueryBuilder:: OR ;
1042 1042
             $builder->addRelationshipFiltersAndSorts($reverseRelName, $filters, $sorts, $joinCondition);
1043 1043
         }
1044 1044
         // ... and the input filters to actual data we select
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
     ) {
1070 1070
         assert(
1071 1071
             $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name),
1072
-            "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`'
1072
+            "Relationship `$name` do not exist in model `".$this->getModelClass().'`'
1073 1073
         );
1074 1074
 
1075 1075
         // depending on the relationship type we expect the result to be either single resource or a collection
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
     ): array {
1099 1099
         assert(
1100 1100
             $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name),
1101
-            "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`'
1101
+            "Relationship `$name` do not exist in model `".$this->getModelClass().'`'
1102 1102
         );
1103 1103
 
1104 1104
         // depending on the relationship type we expect the result to be either single resource or a collection
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 
1168 1168
         $this->clearFetchParameters();
1169 1169
 
1170
-        return (int)$deleted;
1170
+        return (int) $deleted;
1171 1171
     }
1172 1172
 
1173 1173
     /**
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
         $this->clearFetchParameters();
1185 1185
 
1186
-        return (int)$deleted > 0;
1186
+        return (int) $deleted > 0;
1187 1187
     }
1188 1188
 
1189 1189
     /**
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 
1205 1205
         $this->clearBuilderParameters()->clearFetchParameters();
1206 1206
 
1207
-        $this->inTransaction(function () use ($saveMain, $toMany, &$index) {
1207
+        $this->inTransaction(function() use ($saveMain, $toMany, &$index) {
1208 1208
             $saveMain->execute();
1209 1209
 
1210 1210
             // if no index given will use last insert ID as index
@@ -1241,12 +1241,12 @@  discard block
 block discarded – undo
1241 1241
             ->createBuilder($this->getModelClass())
1242 1242
             ->updateModels($allowedChanges)
1243 1243
             ->addFiltersWithAndToTable($filters);
1244
-        $saveMain       = $this->builderSaveResourceOnUpdate($saveMain);
1244
+        $saveMain = $this->builderSaveResourceOnUpdate($saveMain);
1245 1245
         $saveMain->getSQL(); // prepare
1246 1246
 
1247 1247
         $this->clearBuilderParameters()->clearFetchParameters();
1248 1248
 
1249
-        $this->inTransaction(function () use ($saveMain, $toMany, $index, &$updated) {
1249
+        $this->inTransaction(function() use ($saveMain, $toMany, $index, &$updated) {
1250 1250
             $updated = $saveMain->execute();
1251 1251
 
1252 1252
             $builderHook = Closure::fromCallable([$this, 'builderSaveRelationshipOnUpdate']);
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
                 )->execute();
1263 1263
 
1264 1264
                 // add new ones
1265
-                $updated   += $this->addInToManyRelationship(
1265
+                $updated += $this->addInToManyRelationship(
1266 1266
                     $connection,
1267 1267
                     $index,
1268 1268
                     $relationshipName,
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
             }
1273 1273
         });
1274 1274
 
1275
-        return (int)$updated;
1275
+        return (int) $updated;
1276 1276
     }
1277 1277
 
1278 1278
     /**
@@ -1289,9 +1289,9 @@  discard block
 block discarded – undo
1289 1289
     public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int
1290 1290
     {
1291 1291
         // Check that relationship is `BelongsToMany`
1292
-        assert(call_user_func(function () use ($name): bool {
1292
+        assert(call_user_func(function() use ($name): bool {
1293 1293
             $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name);
1294
-            $errMsg  = "Relationship `$name` of class `" . $this->getModelClass() .
1294
+            $errMsg  = "Relationship `$name` of class `".$this->getModelClass().
1295 1295
                 '` either is not `belongsToMany` or do not exist in the class.';
1296 1296
             $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY;
1297 1297
 
@@ -1313,9 +1313,9 @@  discard block
 block discarded – undo
1313 1313
     public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int
1314 1314
     {
1315 1315
         // Check that relationship is `BelongsToMany`
1316
-        assert(call_user_func(function () use ($name): bool {
1316
+        assert(call_user_func(function() use ($name): bool {
1317 1317
             $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name);
1318
-            $errMsg  = "Relationship `$name` of class `" . $this->getModelClass() .
1318
+            $errMsg  = "Relationship `$name` of class `".$this->getModelClass().
1319 1319
                 '` either is not `belongsToMany` or do not exist in the class.';
1320 1320
             $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY;
1321 1321
 
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
     {
1484 1484
         $countBuilder = $this->createBuilder($this->getModelClass());
1485 1485
         $countBuilder->setParameters($builder->getParameters());
1486
-        $countBuilder->select('COUNT(*)')->from('(' . $builder->getSQL() . ') AS RESULT');
1486
+        $countBuilder->select('COUNT(*)')->from('('.$builder->getSQL().') AS RESULT');
1487 1487
 
1488 1488
         return $countBuilder;
1489 1489
     }
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
 
1518 1518
         foreach ($secondaryIdentities as $secondaryId) {
1519 1519
             try {
1520
-                $inserted += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
1520
+                $inserted += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute();
1521 1521
             } /** @noinspection PhpRedundantCatchClauseInspection */ catch (UcvException $exception) {
1522 1522
                 // Spec: If all of the specified resources can be added to, or are already present in,
1523 1523
                 // the relationship then the server MUST return a successful response.
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
 
1765 1765
         $pkName = $this->getModelSchemas()->getPrimaryKey($parentClass);
1766 1766
 
1767
-        $registerModelAtPath = function ($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) {
1767
+        $registerModelAtPath = function($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) {
1768 1768
             return self::registerModelAtPath(
1769 1769
                 $model,
1770 1770
                 $path,
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
         };
1777 1777
 
1778 1778
         foreach ($childRelationships as $name) {
1779
-            $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name;
1779
+            $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name;
1780 1780
 
1781 1781
             $relationshipType = $this->getModelSchemas()->getRelationshipType($parentClass, $name);
1782 1782
             list ($targetModelClass, $reverseRelName) =
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
                             [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]],
1832 1832
                             []
1833 1833
                         );
1834
-                        $children      = $this->fetchPaginatedResourcesWithoutRelationships(
1834
+                        $children = $this->fetchPaginatedResourcesWithoutRelationships(
1835 1835
                             $clonedBuilder,
1836 1836
                             $clonedBuilder->getModelClass()
1837 1837
                         );
Please login to merge, or discard this patch.
src/Api/BasicRelationshipPaginationStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare (strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Limoncello\Flute\Api;
4 4
 
Please login to merge, or discard this patch.
src/Package/FluteSettings.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare (strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Limoncello\Flute\Package;
4 4
 
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
         );
105 105
         assert(empty($jsonQueryValFileMask) === false, "Invalid Query Validators file mask `$jsonQueryValFileMask`.");
106 106
 
107
-        $schemasPath         = $schemasFolder . DIRECTORY_SEPARATOR . $schemasFileMask;
108
-        $jsonDataValPath     = $jsonDataValFolder . DIRECTORY_SEPARATOR . $jsonDataValFileMask;
109
-        $formsValidatorsPath = $formsValFolder . DIRECTORY_SEPARATOR . $formsValFileMask;
110
-        $jsonQueryValPath    = $jsonQueryValFolder . DIRECTORY_SEPARATOR . $jsonQueryValFileMask;
107
+        $schemasPath         = $schemasFolder.DIRECTORY_SEPARATOR.$schemasFileMask;
108
+        $jsonDataValPath     = $jsonDataValFolder.DIRECTORY_SEPARATOR.$jsonDataValFileMask;
109
+        $formsValidatorsPath = $formsValFolder.DIRECTORY_SEPARATOR.$formsValFileMask;
110
+        $jsonQueryValPath    = $jsonQueryValFolder.DIRECTORY_SEPARATOR.$jsonQueryValFileMask;
111 111
 
112 112
         $requireUniqueTypes = $defaults[static::KEY_SCHEMAS_REQUIRE_UNIQUE_TYPES] ?? true;
113 113
 
Please login to merge, or discard this patch.
src/Package/FluteContainerConfigurator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare (strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Limoncello\Flute\Package;
4 4
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
         $container[FactoryInterface::class] = $factory;
57 57
 
58
-        $container[JsonSchemasInterface::class] = function (PsrContainerInterface $container) use ($factory) {
58
+        $container[JsonSchemasInterface::class] = function(PsrContainerInterface $container) use ($factory) {
59 59
             $settings     = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);
60 60
             $modelSchemas = $container->get(ModelSchemaInfoInterface::class);
61 61
 
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
             );
67 67
         };
68 68
 
69
-        $container[ParametersMapperInterface::class] = function (PsrContainerInterface $container) {
69
+        $container[ParametersMapperInterface::class] = function(PsrContainerInterface $container) {
70 70
             return new ParametersMapper($container->get(JsonSchemasInterface::class));
71 71
         };
72 72
 
73
-        $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) {
73
+        $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) {
74 74
             /** @var JsonSchemasInterface $jsonSchemas */
75 75
             $jsonSchemas = $container->get(JsonSchemasInterface::class);
76 76
             $settings    = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);
@@ -86,19 +86,19 @@  discard block
 block discarded – undo
86 86
             return $encoder;
87 87
         };
88 88
 
89
-        $container[RelationshipPaginationStrategyInterface::class] = function (PsrContainerInterface $container) {
89
+        $container[RelationshipPaginationStrategyInterface::class] = function(PsrContainerInterface $container) {
90 90
             $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);
91 91
 
92 92
             return new BasicRelationshipPaginationStrategy($settings[FluteSettings::KEY_DEFAULT_PAGING_SIZE]);
93 93
         };
94 94
 
95
-        $container[JsonApiParserFactoryInterface::class] = function (PsrContainerInterface $container) {
95
+        $container[JsonApiParserFactoryInterface::class] = function(PsrContainerInterface $container) {
96 96
             $factory = new JsonApiParserFactory($container);
97 97
 
98 98
             return $factory;
99 99
         };
100 100
 
101
-        $container[FormValidatorFactoryInterface::class] = function (PsrContainerInterface $container) {
101
+        $container[FormValidatorFactoryInterface::class] = function(PsrContainerInterface $container) {
102 102
             $factory = new FormValidatorFactory($container);
103 103
 
104 104
             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
             /** @var CacheSettingsProviderInterface $provider */
121 121
             $provider      = $container->get(CacheSettingsProviderInterface::class);
122 122
             $appConfig     = $provider->getApplicationConfiguration();
Please login to merge, or discard this patch.
src/Package/FluteProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare (strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Limoncello\Flute\Package;
4 4
 
Please login to merge, or discard this patch.
src/Exceptions/LogicException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare (strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Limoncello\Flute\Exceptions;
4 4
 
Please login to merge, or discard this patch.
src/Factory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare (strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Limoncello\Flute;
4 4
 
Please login to merge, or discard this patch.
src/Types/DateTimeType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare (strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Limoncello\Flute\Types;
4 4
 
Please login to merge, or discard this patch.