@@ -42,5 +42,5 @@ |
||
42 | 42 | * |
43 | 43 | * @return array [$offset, $limit] |
44 | 44 | */ |
45 | - public function parseParameters(?array $parameters): array; |
|
45 | + public function parseParameters(? array $parameters) : array; |
|
46 | 46 | } |
@@ -99,7 +99,7 @@ |
||
99 | 99 | $details = null; |
100 | 100 | if ($this->isDebug === true) { |
101 | 101 | $message = $throwable->getMessage(); |
102 | - $details = (string)$throwable; |
|
102 | + $details = (string) $throwable; |
|
103 | 103 | } |
104 | 104 | $errors->add(new Error(null, null, $httpCode, null, $message, $details)); |
105 | 105 | } |
@@ -125,7 +125,7 @@ discard block |
||
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 | QueryParametersParserInterface::PARAM_PAGE => [ |
131 | 131 | PaginationStrategyInterface::PARAM_PAGING_SKIP => $offset, |
@@ -133,7 +133,7 @@ discard block |
||
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; |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | assert(array_key_exists(SchemaInterface::class, class_implements($schemeClass)) === true); |
54 | 54 | $type = $schemeClass::TYPE; |
55 | 55 | |
56 | - $indexSlug = '/{' . CI::ROUTE_KEY_INDEX . '}'; |
|
57 | - $params = function ($method) use ($type) { |
|
58 | - return [RouteInterface::PARAM_NAME => $type . '_' . $method]; |
|
56 | + $indexSlug = '/{'.CI::ROUTE_KEY_INDEX.'}'; |
|
57 | + $params = function($method) use ($type) { |
|
58 | + return [RouteInterface::PARAM_NAME => $type.'_'.$method]; |
|
59 | 59 | }; |
60 | - $handler = function ($method) use ($controllerClass) { |
|
60 | + $handler = function($method) use ($controllerClass) { |
|
61 | 61 | return [$controllerClass, $method]; |
62 | 62 | }; |
63 | 63 | |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | $group->post($type, $handler(CI::METHOD_CREATE), $params(CI::METHOD_CREATE)); |
71 | 71 | } |
72 | 72 | if (in_array(ControllerReadInterface::class, $classInterfaces) === true) { |
73 | - $group->get($type . $indexSlug, $handler(CI::METHOD_READ), $params(CI::METHOD_READ)); |
|
73 | + $group->get($type.$indexSlug, $handler(CI::METHOD_READ), $params(CI::METHOD_READ)); |
|
74 | 74 | } |
75 | 75 | if (in_array(ControllerUpdateInterface::class, $classInterfaces) === true) { |
76 | - $group->patch($type . $indexSlug, $handler(CI::METHOD_UPDATE), $params(CI::METHOD_UPDATE)); |
|
76 | + $group->patch($type.$indexSlug, $handler(CI::METHOD_UPDATE), $params(CI::METHOD_UPDATE)); |
|
77 | 77 | } |
78 | 78 | if (in_array(ControllerDeleteInterface::class, $classInterfaces) === true) { |
79 | - $group->delete($type . $indexSlug, $handler(CI::METHOD_DELETE), $params(CI::METHOD_DELETE)); |
|
79 | + $group->delete($type.$indexSlug, $handler(CI::METHOD_DELETE), $params(CI::METHOD_DELETE)); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return $group; |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | */ |
92 | 92 | protected static function controller(GroupInterface $group, string $subUri, string $controllerClass): GroupInterface |
93 | 93 | { |
94 | - $slugged = $subUri . '/{' . CI::ROUTE_KEY_INDEX . '}'; |
|
95 | - $params = function ($method) use ($subUri) { |
|
96 | - return [RouteInterface::PARAM_NAME => $subUri . '_' . $method]; |
|
94 | + $slugged = $subUri.'/{'.CI::ROUTE_KEY_INDEX.'}'; |
|
95 | + $params = function($method) use ($subUri) { |
|
96 | + return [RouteInterface::PARAM_NAME => $subUri.'_'.$method]; |
|
97 | 97 | }; |
98 | - $handler = function ($method) use ($controllerClass) { |
|
98 | + $handler = function($method) use ($controllerClass) { |
|
99 | 99 | return [$controllerClass, $method]; |
100 | 100 | }; |
101 | 101 | |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | $group->get($slugged, $handler(CI::METHOD_READ), $params(CI::METHOD_READ)); |
113 | 113 | } |
114 | 114 | if (in_array(ControllerUpdateInterface::class, $classInterfaces) === true) { |
115 | - $updateUri = $slugged . '/' . CI::METHOD_UPDATE; |
|
115 | + $updateUri = $slugged.'/'.CI::METHOD_UPDATE; |
|
116 | 116 | $group->post($updateUri, $handler(CI::METHOD_UPDATE), $params(CI::METHOD_UPDATE)); |
117 | 117 | } |
118 | 118 | if (in_array(ControllerDeleteInterface::class, $classInterfaces) === true) { |
119 | - $deleteUri = $slugged . '/' . CI::METHOD_DELETE; |
|
119 | + $deleteUri = $slugged.'/'.CI::METHOD_DELETE; |
|
120 | 120 | $group->post($deleteUri, $handler(CI::METHOD_DELETE), $params(CI::METHOD_DELETE)); |
121 | 121 | } |
122 | 122 | |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | /** @var string $controllerClass */ |
149 | 149 | /** @var string $schemaClass */ |
150 | 150 | |
151 | - $resourceIdUri = $subUri . '/{' . CI::ROUTE_KEY_INDEX . '}/'; |
|
152 | - $selfUri = $resourceIdUri . DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName; |
|
151 | + $resourceIdUri = $subUri.'/{'.CI::ROUTE_KEY_INDEX.'}/'; |
|
152 | + $selfUri = $resourceIdUri.DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$relationshipName; |
|
153 | 153 | |
154 | 154 | return $group |
155 | 155 | // `self` |
156 | 156 | ->get($selfUri, [$controllerClass, $selfGetMethod]) |
157 | 157 | // `related` |
158 | - ->get($resourceIdUri . $relationshipName, [$controllerClass, $selfGetMethod]); |
|
158 | + ->get($resourceIdUri.$relationshipName, [$controllerClass, $selfGetMethod]); |
|
159 | 159 | } |
160 | 160 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @inheritdoc |
70 | 70 | */ |
71 | - public function parseParameters(?array $parameters): array |
|
71 | + public function parseParameters(? array $parameters) : array |
|
72 | 72 | { |
73 | 73 | if ($parameters === null) { |
74 | 74 | return [0, $this->getDefaultPageSize()]; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 0, |
82 | 82 | PHP_INT_MAX |
83 | 83 | ); |
84 | - $size = $this->getValue( |
|
84 | + $size = $this->getValue( |
|
85 | 85 | $parameters, |
86 | 86 | static::PARAM_PAGING_SIZE, |
87 | 87 | $this->getDefaultPageSize(), |
@@ -208,12 +208,12 @@ |
||
208 | 208 | return [static::DATA => $data->getData()]; |
209 | 209 | } |
210 | 210 | |
211 | - $buildUrl = function ($offset) use ($data, $uri) { |
|
211 | + $buildUrl = function($offset) use ($data, $uri) { |
|
212 | 212 | $paramsWithPaging = [ |
213 | 213 | PaginationStrategyInterface::PARAM_PAGING_SKIP => $offset, |
214 | 214 | PaginationStrategyInterface::PARAM_PAGING_SIZE => $data->getLimit(), |
215 | 215 | ]; |
216 | - $fullUrl = $uri . '?' . http_build_query($paramsWithPaging); |
|
216 | + $fullUrl = $uri.'?'.http_build_query($paramsWithPaging); |
|
217 | 217 | |
218 | 218 | return $fullUrl; |
219 | 219 | }; |
@@ -48,7 +48,7 @@ discard block |
||
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 |
||
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 | } |
@@ -121,7 +121,7 @@ |
||
121 | 121 | * |
122 | 122 | * @return array|null |
123 | 123 | */ |
124 | - public function fetchRow(QueryBuilder $builder, string $modelClass): ?array; |
|
124 | + public function fetchRow(QueryBuilder $builder, string $modelClass): ? array; |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * @param QueryBuilder $builder |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | string $relationshipName, |
290 | 290 | iterable $relationshipFilters, |
291 | 291 | ?iterable $relationshipSorts |
292 | - ): self { |
|
292 | + ) : self { |
|
293 | 293 | $joinWith = $this->expr()->andX(); |
294 | 294 | |
295 | 295 | return $this->addRelationshipFiltersAndSorts( |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | string $relationshipName, |
324 | 324 | iterable $relationshipFilters, |
325 | 325 | ?iterable $relationshipSorts |
326 | - ): self { |
|
326 | + ) : self { |
|
327 | 327 | $joinWith = $this->expr()->orX(); |
328 | 328 | |
329 | 329 | return $this->addRelationshipFiltersAndSorts( |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | CompositeExpression $filterLink, |
387 | 387 | iterable $relationshipFilters, |
388 | 388 | ?iterable $relationshipSorts |
389 | - ): self { |
|
389 | + ) : self { |
|
390 | 390 | $relationshipType = $this->getModelSchemes()->getRelationshipType($this->getModelClass(), $relationshipName); |
391 | 391 | switch ($relationshipType) { |
392 | 392 | case RelationshipTypes::BELONGS_TO: |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | CompositeExpression $filterLink, |
460 | 460 | iterable $relationshipFilters, |
461 | 461 | ?iterable $relationshipSorts |
462 | - ): self { |
|
462 | + ) : self { |
|
463 | 463 | $foreignKey = $this->getModelSchemes()->getForeignKey($this->getModelClass(), $relationshipName); |
464 | 464 | list($onePrimaryKey, $oneTable) = |
465 | 465 | $this->getModelSchemes()->getReversePrimaryKey($this->getModelClass(), $relationshipName); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | CompositeExpression $filterLink, |
492 | 492 | iterable $relationshipFilters, |
493 | 493 | ?iterable $relationshipSorts |
494 | - ): self { |
|
494 | + ) : self { |
|
495 | 495 | $primaryKey = $this->getModelSchemes()->getPrimaryKey($this->getModelClass()); |
496 | 496 | list($manyForeignKey, $manyTable) = |
497 | 497 | $this->getModelSchemes()->getReverseForeignKey($this->getModelClass(), $relationshipName); |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | CompositeExpression $targetFilterLink, |
524 | 524 | iterable $relationshipFilters, |
525 | 525 | ?iterable $relationshipSorts |
526 | - ): self { |
|
526 | + ) : self { |
|
527 | 527 | $primaryKey = $this->getModelSchemes()->getPrimaryKey($this->getModelClass()); |
528 | 528 | list ($intermediateTable, $intermediatePk, $intermediateFk) = |
529 | 529 | $this->getModelSchemes()->getBelongsToManyRelationship($this->getModelClass(), $relationshipName); |
@@ -571,9 +571,9 @@ discard block |
||
571 | 571 | ?CompositeExpression $targetFilterLink, |
572 | 572 | ?iterable $targetFilterParams, |
573 | 573 | ?iterable $relationshipSorts |
574 | - ): string { |
|
574 | + ) : string { |
|
575 | 575 | $targetAlias = $this->createAlias($targetTable); |
576 | - $joinCondition = $this->buildColumnName($fromAlias, $fromColumn) . '=' . |
|
576 | + $joinCondition = $this->buildColumnName($fromAlias, $fromColumn).'='. |
|
577 | 577 | $this->buildColumnName($targetAlias, $targetColumn); |
578 | 578 | |
579 | 579 | $this->innerJoin( |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | ?CompositeExpression $targetFilterLink, |
633 | 633 | ?iterable $targetFilterParams, |
634 | 634 | ?iterable $targetSortParams |
635 | - ): string { |
|
635 | + ) : string { |
|
636 | 636 | $intNoSorting = null; |
637 | 637 | $intAlias = $this->innerJoinOneTable( |
638 | 638 | $fromAlias, |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $intFilterParams, |
644 | 644 | $intNoSorting |
645 | 645 | ); |
646 | - $targetAlias = $this->innerJoinOneTable( |
|
646 | + $targetAlias = $this->innerJoinOneTable( |
|
647 | 647 | $intAlias, |
648 | 648 | $intToTargetColumn, |
649 | 649 | $targetTable, |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | private function createAlias(string $tableName): string |
665 | 665 | { |
666 | - $alias = $tableName . (++$this->aliasIdCounter); |
|
666 | + $alias = $tableName.(++$this->aliasIdCounter); |
|
667 | 667 | $this->knownAliases[$tableName] = $alias; |
668 | 668 | |
669 | 669 | return $alias; |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | } else { |
828 | 828 | assert( |
829 | 829 | $value !== null, |
830 | - 'It seems you are trying to use `null` with =, >, <, or etc operator. ' . |
|
830 | + 'It seems you are trying to use `null` with =, >, <, or etc operator. '. |
|
831 | 831 | 'Use `is null` or `not null` instead.' |
832 | 832 | ); |
833 | 833 | assert(is_string($value), "Only strings, booleans and integers are supported."); |