@@ -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 | } |
@@ -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 | } |
@@ -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 |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | protected static function readJsonFromRequest(ContainerInterface $container, ServerRequestInterface $request): array |
242 | 242 | { |
243 | - $body = (string)$request->getBody(); |
|
243 | + $body = (string) $request->getBody(); |
|
244 | 244 | if (empty($body) === true || ($json = json_decode($body, true)) === null) { |
245 | 245 | /** @var FactoryInterface $factory */ |
246 | 246 | $factory = $container->get(FactoryInterface::class); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | { |
384 | 384 | assert( |
385 | 385 | empty(static::ON_CREATE_VALIDATION_RULES_SET_CLASS) === false, |
386 | - 'Validation rules set should be defined for class ' . static::class . '.' |
|
386 | + 'Validation rules set should be defined for class '.static::class.'.' |
|
387 | 387 | ); |
388 | 388 | |
389 | 389 | return static::createJsonApiValidator($container, static::ON_CREATE_VALIDATION_RULES_SET_CLASS); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | { |
399 | 399 | assert( |
400 | 400 | empty(static::ON_UPDATE_VALIDATION_RULES_SET_CLASS) === false, |
401 | - 'Validation rules set should be defined for class ' . static::class . '.' |
|
401 | + 'Validation rules set should be defined for class '.static::class.'.' |
|
402 | 402 | ); |
403 | 403 | |
404 | 404 | return static::createJsonApiValidator($container, static::ON_UPDATE_VALIDATION_RULES_SET_CLASS); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | ContainerInterface $container, |
607 | 607 | ServerRequestInterface $request |
608 | 608 | ): array { |
609 | - $jsonData = static::normalizeIndexValueOnUpdate( |
|
609 | + $jsonData = static::normalizeIndexValueOnUpdate( |
|
610 | 610 | $routeParams, |
611 | 611 | $container, |
612 | 612 | static::readJsonFromRequest($container, $request) |
@@ -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; |
@@ -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 | } |