@@ -82,7 +82,6 @@ |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | return $result === true ? |
85 | - static::createSuccessReply($values) : |
|
86 | - static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
85 | + static::createSuccessReply($values) : static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
87 | 86 | } |
88 | 87 | } |
@@ -83,13 +83,12 @@ |
||
83 | 83 | ->where($builder->expr()->in($primaryName, $placeholders)) |
84 | 84 | ->execute(); |
85 | 85 | |
86 | - $count = (int)$statement->fetchColumn(); |
|
86 | + $count = (int) $statement->fetchColumn(); |
|
87 | 87 | $result = $count === count($values); |
88 | 88 | } |
89 | 89 | |
90 | 90 | $reply = $result === true ? |
91 | - static::createSuccessReply($values) : |
|
92 | - static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
91 | + static::createSuccessReply($values) : static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
93 | 92 | |
94 | 93 | return $reply; |
95 | 94 | } |
@@ -242,12 +242,11 @@ discard block |
||
242 | 242 | $this->executeStarts($this->getSerializer()::readRuleStartIndexes($ruleIndexes)); |
243 | 243 | $ruleIndex = $this->getSerializer()::readRuleIndex($ruleIndexes); |
244 | 244 | $isFoundInToOne === true ? |
245 | - $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) : |
|
246 | - $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData); |
|
245 | + $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) : $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData); |
|
247 | 246 | $this->executeEnds($this->getSerializer()::readRuleEndIndexes($ruleIndexes)); |
248 | 247 | |
249 | 248 | if (count($this->getErrorAggregator()) > 0) { |
250 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
249 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
251 | 250 | foreach ($this->getErrorAggregator()->get() as $error) { |
252 | 251 | $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status); |
253 | 252 | $this->addErrorStatus($status); |
@@ -362,7 +361,7 @@ discard block |
||
362 | 361 | |
363 | 362 | if (count($this->getErrorAggregator()) > 0) { |
364 | 363 | $title = $this->formatMessage(ErrorCodes::INVALID_VALUE); |
365 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
364 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
366 | 365 | foreach ($this->getErrorAggregator()->get() as $error) { |
367 | 366 | $details = $this->getMessage($error); |
368 | 367 | $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, $status); |
@@ -453,7 +452,7 @@ discard block |
||
453 | 452 | $this->executeEnds($this->getSerializer()::readRulesEndIndexes($this->getAttributeRules())); |
454 | 453 | |
455 | 454 | if (count($this->getErrorAggregator()) > 0) { |
456 | - $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
|
455 | + $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
|
457 | 456 | foreach ($this->getErrorAggregator()->get() as $error) { |
458 | 457 | $this->getJsonApiErrorCollection()->addValidationAttributeError($error, $status); |
459 | 458 | } |
@@ -520,7 +519,7 @@ discard block |
||
520 | 519 | )); |
521 | 520 | |
522 | 521 | if (count($this->getErrorAggregator()) > 0) { |
523 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
522 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
524 | 523 | foreach ($this->getErrorAggregator()->get() as $error) { |
525 | 524 | $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status); |
526 | 525 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $container[FactoryInterface::class] = $factory; |
55 | 55 | |
56 | - $container[JsonSchemasInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
56 | + $container[JsonSchemasInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
57 | 57 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
58 | 58 | $modelSchemas = $container->get(ModelSchemaInfoInterface::class); |
59 | 59 | |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | ); |
65 | 65 | }; |
66 | 66 | |
67 | - $container[ParametersMapperInterface::class] = function (PsrContainerInterface $container) { |
|
67 | + $container[ParametersMapperInterface::class] = function(PsrContainerInterface $container) { |
|
68 | 68 | return new ParametersMapper($container->get(JsonSchemasInterface::class)); |
69 | 69 | }; |
70 | 70 | |
71 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
71 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
72 | 72 | /** @var JsonSchemasInterface $jsonSchemas */ |
73 | 73 | $jsonSchemas = $container->get(JsonSchemasInterface::class); |
74 | 74 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -84,19 +84,19 @@ discard block |
||
84 | 84 | return $encoder; |
85 | 85 | }; |
86 | 86 | |
87 | - $container[RelationshipPaginationStrategyInterface::class] = function (PsrContainerInterface $container) { |
|
87 | + $container[RelationshipPaginationStrategyInterface::class] = function(PsrContainerInterface $container) { |
|
88 | 88 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
89 | 89 | |
90 | 90 | return new BasicRelationshipPaginationStrategy($settings[FluteSettings::KEY_DEFAULT_PAGING_SIZE]); |
91 | 91 | }; |
92 | 92 | |
93 | - $container[JsonApiParserFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
93 | + $container[JsonApiParserFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
94 | 94 | $factory = new JsonApiParserFactory($container); |
95 | 95 | |
96 | 96 | return $factory; |
97 | 97 | }; |
98 | 98 | |
99 | - $container[FormValidatorFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
99 | + $container[FormValidatorFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
100 | 100 | $factory = new FormValidatorFactory($container); |
101 | 101 | |
102 | 102 | return $factory; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public static function configureExceptionHandler(LimoncelloContainerInterface $container) |
116 | 116 | { |
117 | - $container[ThrowableHandlerInterface::class] = function (PsrContainerInterface $container) { |
|
117 | + $container[ThrowableHandlerInterface::class] = function(PsrContainerInterface $container) { |
|
118 | 118 | /** @var CacheSettingsProviderInterface $provider */ |
119 | 119 | $provider = $container->get(CacheSettingsProviderInterface::class); |
120 | 120 | $appConfig = $provider->getApplicationConfiguration(); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | parse_str($this->getOriginalUri()->getQuery(), $queryParams); |
126 | 126 | |
127 | - return function ($offset) use ($pageSize, $queryParams) { |
|
127 | + return function($offset) use ($pageSize, $queryParams) { |
|
128 | 128 | $paramsWithPaging = array_merge($queryParams, [ |
129 | 129 | BaseQueryParserInterface::PARAM_PAGE => [ |
130 | 130 | JsonApiQueryParserInterface::PARAM_PAGING_OFFSET => $offset, |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ], |
133 | 133 | ]); |
134 | 134 | $newUri = $this->getOriginalUri()->withQuery(http_build_query($paramsWithPaging)); |
135 | - $fullUrl = (string)$newUri; |
|
135 | + $fullUrl = (string) $newUri; |
|
136 | 136 | $link = $this->getFactory()->createLink(false, $fullUrl, false); |
137 | 137 | |
138 | 138 | return $link; |
@@ -130,7 +130,7 @@ |
||
130 | 130 | $details = null; |
131 | 131 | if ($this->isDebug === true) { |
132 | 132 | $message = $throwable->getMessage(); |
133 | - $details = (string)$throwable; |
|
133 | + $details = (string) $throwable; |
|
134 | 134 | } |
135 | 135 | $errors->add(new Error(null, null, null, $httpCode, null, $message, $details)); |
136 | 136 | } |
@@ -235,14 +235,14 @@ discard block |
||
235 | 235 | // if we are here then relationship contains paginated data, so we have to add pagination links |
236 | 236 | $offset = $relationshipData->getOffset(); |
237 | 237 | $limit = $relationshipData->getLimit(); |
238 | - $urlPrefix = $this->getRelationshipSelfSubUrl($model, $jsonRelName) . '?'; |
|
239 | - $buildLink = function (int $offset, int $limit) use ($urlPrefix) : LinkInterface { |
|
238 | + $urlPrefix = $this->getRelationshipSelfSubUrl($model, $jsonRelName).'?'; |
|
239 | + $buildLink = function(int $offset, int $limit) use ($urlPrefix) : LinkInterface { |
|
240 | 240 | $paramsWithPaging = [ |
241 | 241 | JsonApiQueryParserInterface::PARAM_PAGING_OFFSET => $offset, |
242 | 242 | JsonApiQueryParserInterface::PARAM_PAGING_LIMIT => $limit, |
243 | 243 | ]; |
244 | 244 | |
245 | - $subUrl = $urlPrefix . http_build_query($paramsWithPaging); |
|
245 | + $subUrl = $urlPrefix.http_build_query($paramsWithPaging); |
|
246 | 246 | |
247 | 247 | return $this->getFactory()->createLink(true, $subUrl, false); |
248 | 248 | }; |
@@ -341,6 +341,6 @@ discard block |
||
341 | 341 | */ |
342 | 342 | private function getRelationshipSelfSubUrl(ModelInterface $model, string $jsonRelName): string |
343 | 343 | { |
344 | - return $this->getSelfSubUrl($model) . '/relationships/' . $jsonRelName; |
|
344 | + return $this->getSelfSubUrl($model).'/relationships/'.$jsonRelName; |
|
345 | 345 | } |
346 | 346 | } |