@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\Form\Execution; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi; |
| 4 | 4 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $title = $this->formatMessage(Messages::INVALID_VALUE); |
| 231 | 231 | $details = $this->formatMessage(Messages::UNKNOWN_RELATIONSHIP); |
| 232 | 232 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 233 | - $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string)$status); |
|
| 233 | + $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string) $status); |
|
| 234 | 234 | $this->addErrorStatus($status); |
| 235 | 235 | } else { |
| 236 | 236 | assert($isFoundInToOne xor $isFoundInToMany); |
@@ -243,12 +243,11 @@ discard block |
||
| 243 | 243 | $this->executeStarts($this->getSerializer()::readRuleStartIndexes($ruleIndexes)); |
| 244 | 244 | $ruleIndex = $this->getSerializer()::readRuleIndex($ruleIndexes); |
| 245 | 245 | $isFoundInToOne === true ? |
| 246 | - $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) : |
|
| 247 | - $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData); |
|
| 246 | + $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) : $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData); |
|
| 248 | 247 | $this->executeEnds($this->getSerializer()::readRuleEndIndexes($ruleIndexes)); |
| 249 | 248 | |
| 250 | 249 | if (count($this->getErrorAggregator()) > 0) { |
| 251 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
| 250 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
| 252 | 251 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 253 | 252 | $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status); |
| 254 | 253 | $this->addErrorStatus($status); |
@@ -354,7 +353,7 @@ discard block |
||
| 354 | 353 | $title = $this->formatMessage(Messages::INVALID_VALUE); |
| 355 | 354 | $details = $this->formatMessage(Messages::TYPE_MISSING); |
| 356 | 355 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 357 | - $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, (string)$status); |
|
| 356 | + $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, (string) $status); |
|
| 358 | 357 | $this->addErrorStatus($status); |
| 359 | 358 | } |
| 360 | 359 | |
@@ -366,7 +365,7 @@ discard block |
||
| 366 | 365 | $status = JsonApiResponse::HTTP_CONFLICT; |
| 367 | 366 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 368 | 367 | $details = $this->getMessage($error); |
| 369 | - $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, (string)$status); |
|
| 368 | + $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, (string) $status); |
|
| 370 | 369 | } |
| 371 | 370 | $this->addErrorStatus($status); |
| 372 | 371 | $this->getErrorAggregator()->clear(); |
@@ -403,7 +402,7 @@ discard block |
||
| 403 | 402 | $status = JsonApiResponse::HTTP_CONFLICT; |
| 404 | 403 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 405 | 404 | $details = $this->getMessage($error); |
| 406 | - $this->getJsonApiErrorCollection()->addDataIdError($title, $details, (string)$status); |
|
| 405 | + $this->getJsonApiErrorCollection()->addDataIdError($title, $details, (string) $status); |
|
| 407 | 406 | } |
| 408 | 407 | $this->addErrorStatus($status); |
| 409 | 408 | $this->getErrorAggregator()->clear(); |
@@ -432,7 +431,7 @@ discard block |
||
| 432 | 431 | $title = $this->formatMessage(Messages::INVALID_VALUE); |
| 433 | 432 | $details = $this->formatMessage(Messages::INVALID_ATTRIBUTES); |
| 434 | 433 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 435 | - $this->getJsonApiErrorCollection()->addAttributesError($title, $details, (string)$status); |
|
| 434 | + $this->getJsonApiErrorCollection()->addAttributesError($title, $details, (string) $status); |
|
| 436 | 435 | $this->addErrorStatus($status); |
| 437 | 436 | } else { |
| 438 | 437 | // execute main validation block(s) |
@@ -444,7 +443,7 @@ discard block |
||
| 444 | 443 | $details = $this->formatMessage(Messages::UNKNOWN_ATTRIBUTE); |
| 445 | 444 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 446 | 445 | $this->getJsonApiErrorCollection() |
| 447 | - ->addDataAttributeError($name, $title, $details, (string)$status); |
|
| 446 | + ->addDataAttributeError($name, $title, $details, (string) $status); |
|
| 448 | 447 | $this->addErrorStatus($status); |
| 449 | 448 | } |
| 450 | 449 | } |
@@ -455,7 +454,7 @@ discard block |
||
| 455 | 454 | $this->executeEnds($this->getSerializer()::readRulesEndIndexes($this->getAttributeRules())); |
| 456 | 455 | |
| 457 | 456 | if (count($this->getErrorAggregator()) > 0) { |
| 458 | - $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
|
| 457 | + $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
|
| 459 | 458 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 460 | 459 | $this->getJsonApiErrorCollection()->addValidationAttributeError($error, $status); |
| 461 | 460 | } |
@@ -489,7 +488,7 @@ discard block |
||
| 489 | 488 | $title = $this->formatMessage(Messages::INVALID_VALUE); |
| 490 | 489 | $details = $this->formatMessage(Messages::INVALID_RELATIONSHIP_TYPE); |
| 491 | 490 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 492 | - $this->getJsonApiErrorCollection()->addRelationshipsError($title, $details, (string)$status); |
|
| 491 | + $this->getJsonApiErrorCollection()->addRelationshipsError($title, $details, (string) $status); |
|
| 493 | 492 | $this->addErrorStatus($status); |
| 494 | 493 | } else { |
| 495 | 494 | // ok we got to something that could be null or a valid relationship |
@@ -509,7 +508,7 @@ discard block |
||
| 509 | 508 | $details = $this->formatMessage(Messages::UNKNOWN_RELATIONSHIP); |
| 510 | 509 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 511 | 510 | $this->getJsonApiErrorCollection() |
| 512 | - ->addRelationshipError($name, $title, $details, (string)$status); |
|
| 511 | + ->addRelationshipError($name, $title, $details, (string) $status); |
|
| 513 | 512 | $this->addErrorStatus($status); |
| 514 | 513 | } |
| 515 | 514 | } |
@@ -523,7 +522,7 @@ discard block |
||
| 523 | 522 | )); |
| 524 | 523 | |
| 525 | 524 | if (count($this->getErrorAggregator()) > 0) { |
| 526 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
| 525 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
| 527 | 526 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 528 | 527 | $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status); |
| 529 | 528 | } |
@@ -555,7 +554,7 @@ discard block |
||
| 555 | 554 | $title = $this->formatMessage(Messages::INVALID_VALUE); |
| 556 | 555 | $details = $this->formatMessage(Messages::INVALID_RELATIONSHIP); |
| 557 | 556 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 558 | - $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string)$status); |
|
| 557 | + $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string) $status); |
|
| 559 | 558 | $this->addErrorStatus($status); |
| 560 | 559 | } |
| 561 | 560 | } |
@@ -597,7 +596,7 @@ discard block |
||
| 597 | 596 | $title = $this->formatMessage(Messages::INVALID_VALUE); |
| 598 | 597 | $details = $this->formatMessage(Messages::INVALID_RELATIONSHIP); |
| 599 | 598 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 600 | - $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string)$status); |
|
| 599 | + $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string) $status); |
|
| 601 | 600 | $this->addErrorStatus($status); |
| 602 | 601 | } |
| 603 | 602 | } |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi\Execution; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi\Rules; |
| 4 | 4 | |
@@ -86,13 +86,12 @@ discard block |
||
| 86 | 86 | ->where($builder->expr()->in($primaryName, $placeholders)) |
| 87 | 87 | ->execute(); |
| 88 | 88 | |
| 89 | - $count = (int)$statement->fetchColumn(); |
|
| 89 | + $count = (int) $statement->fetchColumn(); |
|
| 90 | 90 | $result = $count === count($values); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $reply = $result === true ? |
| 94 | - static::createSuccessReply($values) : |
|
| 95 | - static::createErrorReply( |
|
| 94 | + static::createSuccessReply($values) : static::createErrorReply( |
|
| 96 | 95 | $context, |
| 97 | 96 | $values, |
| 98 | 97 | ErrorCodes::EXIST_IN_DATABASE_MULTIPLE, |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi\Rules; |
| 4 | 4 | |
@@ -84,8 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $reply = $count <= 0 ? |
| 87 | - static::createSuccessReply($value) : |
|
| 88 | - static::createErrorReply( |
|
| 87 | + static::createSuccessReply($value) : static::createErrorReply( |
|
| 89 | 88 | $context, |
| 90 | 89 | $value, |
| 91 | 90 | ErrorCodes::UNIQUE_IN_DATABASE_SINGLE, |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi\Rules; |
| 4 | 4 | |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $reply = $count > 0 ? |
| 88 | - static::createSuccessReply($value) : |
|
| 89 | - static::createErrorReply( |
|
| 88 | + static::createSuccessReply($value) : static::createErrorReply( |
|
| 90 | 89 | $context, |
| 91 | 90 | $value, |
| 92 | 91 | ErrorCodes::EXIST_IN_DATABASE_SINGLE, |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi\Rules; |
| 4 | 4 | |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | assert(is_scalar($index) === true && is_scalar($type) === true); |
| 66 | 66 | $expectedType = $context->getProperties()->getProperty(static::PROPERTY_RESOURCE_TYPE); |
| 67 | 67 | $reply = $type === $expectedType ? |
| 68 | - static::createSuccessReply($index) : |
|
| 69 | - static::createErrorReply( |
|
| 68 | + static::createSuccessReply($index) : static::createErrorReply( |
|
| 70 | 69 | $context, |
| 71 | 70 | $type, |
| 72 | 71 | ErrorCodes::INVALID_RELATIONSHIP_TYPE, |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi\Rules; |
| 4 | 4 | |
@@ -75,12 +75,11 @@ discard block |
||
| 75 | 75 | /** @var CrudInterface $api */ |
| 76 | 76 | $api = $apiFactory->createApi($apiClass); |
| 77 | 77 | |
| 78 | - $data = $api->withIndexFilter((string)$value)->indexIdentities(); |
|
| 78 | + $data = $api->withIndexFilter((string) $value)->indexIdentities(); |
|
| 79 | 79 | $result = !empty($data); |
| 80 | 80 | |
| 81 | 81 | return $result === true ? |
| 82 | - static::createSuccessReply($value) : |
|
| 83 | - static::createErrorReply( |
|
| 82 | + static::createSuccessReply($value) : static::createErrorReply( |
|
| 84 | 83 | $context, |
| 85 | 84 | $value, |
| 86 | 85 | ErrorCodes::EXIST_IN_DATABASE_SINGLE, |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi\Rules; |
| 4 | 4 | |
@@ -74,8 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $reply = $foundInvalidType === null ? |
| 77 | - static::createSuccessReply($indexes) : |
|
| 78 | - static::createErrorReply( |
|
| 77 | + static::createSuccessReply($indexes) : static::createErrorReply( |
|
| 79 | 78 | $context, |
| 80 | 79 | $foundInvalidType, |
| 81 | 80 | ErrorCodes::INVALID_RELATIONSHIP_TYPE, |