@@ -41,7 +41,7 @@ |
||
| 41 | 41 | public static function execute($value, ContextInterface $context): array |
| 42 | 42 | { |
| 43 | 43 | if (is_string($value) === true || is_numeric($value) === true) { |
| 44 | - return static::createSuccessReply((int)$value); |
|
| 44 | + return static::createSuccessReply((int) $value); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return static::createErrorReply($context, $value, ErrorCodes::IS_INT, Messages::IS_INT, []); |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | if (is_array($value) === true) { |
| 49 | 49 | foreach ($value as $key => $mightBeString) { |
| 50 | 50 | if (is_string($mightBeString) === true || is_numeric($mightBeString) === true) { |
| 51 | - $result[$key] = (int)$mightBeString; |
|
| 51 | + $result[$key] = (int) $mightBeString; |
|
| 52 | 52 | } else { |
| 53 | 53 | $reply = static::createErrorReply( |
| 54 | 54 | $context, |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | public static function execute($value, ContextInterface $context): array |
| 42 | 42 | { |
| 43 | 43 | if (is_string($value) === true || is_numeric($value) === true) { |
| 44 | - return static::createSuccessReply((float)$value); |
|
| 44 | + return static::createSuccessReply((float) $value); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return static::createErrorReply($context, $value, ErrorCodes::IS_FLOAT, Messages::IS_FLOAT, []); |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | // 'address1' => 'Dow 1', // missed required parameter |
| 68 | 68 | 'accepted' => 'false', |
| 69 | 69 | ]; |
| 70 | - $this->console('Invalid data (errors)' . PHP_EOL); |
|
| 70 | + $this->console('Invalid data (errors)'.PHP_EOL); |
|
| 71 | 71 | $validator->validate($invalidInput); |
| 72 | 72 | $this->printErrors($validator->getErrors()); |
| 73 | - $this->console('Invalid data (captures)' . PHP_EOL); |
|
| 73 | + $this->console('Invalid data (captures)'.PHP_EOL); |
|
| 74 | 74 | $this->printCaptures($validator->getCaptures()); |
| 75 | 75 | |
| 76 | 76 | // Check with valid data |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | 'address2' => null, |
| 84 | 84 | 'accepted' => 'true', |
| 85 | 85 | ]; |
| 86 | - $this->console(PHP_EOL . 'Valid data (errors)' . PHP_EOL); |
|
| 86 | + $this->console(PHP_EOL.'Valid data (errors)'.PHP_EOL); |
|
| 87 | 87 | $validator->validate($validInput); |
| 88 | 88 | $this->printErrors($validator->getErrors()); |
| 89 | - $this->console('Valid data (captures)' . PHP_EOL); |
|
| 89 | + $this->console('Valid data (captures)'.PHP_EOL); |
|
| 90 | 90 | $this->printCaptures($validator->getCaptures()); |
| 91 | 91 | |
| 92 | 92 | // The output would be |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | $context = $error->getMessageParameters(); |
| 135 | 135 | $errorMsg = MessageFormatter::formatMessage('en', $errorMsg, $context !== null ? $context : []); |
| 136 | 136 | |
| 137 | - $this->console("$entry failed for `$paramValue` with: $errorMsg" . PHP_EOL); |
|
| 137 | + $this->console("$entry failed for `$paramValue` with: $errorMsg".PHP_EOL); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if ($hasErrors === false) { |
| 141 | - $this->console('No errors' . PHP_EOL); |
|
| 141 | + $this->console('No errors'.PHP_EOL); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | $hasCaptures = true; |
| 156 | 156 | $type = gettype($value); |
| 157 | 157 | $value = $value instanceof DateTimeInterface ? $value->format(DateTime::ISO8601) : $value; |
| 158 | - $this->console("`$name` = `$value` ($type)" . PHP_EOL); |
|
| 158 | + $this->console("`$name` = `$value` ($type)".PHP_EOL); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if ($hasCaptures === false) { |
| 162 | - $this->console('No captures' . PHP_EOL); |
|
| 162 | + $this->console('No captures'.PHP_EOL); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -45,8 +45,7 @@ |
||
| 45 | 45 | $isValidDeliveryDate = $value instanceof DateTimeInterface === true && $value >= $from && $value <= $to; |
| 46 | 46 | |
| 47 | 47 | return $isValidDeliveryDate === true ? |
| 48 | - static::createSuccessReply($value) : |
|
| 49 | - static::createErrorReply( |
|
| 48 | + static::createSuccessReply($value) : static::createErrorReply( |
|
| 50 | 49 | $context, |
| 51 | 50 | $value, |
| 52 | 51 | Errors::IS_DELIVERY_DATE, |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | $idExists = is_int($value) === true && $value < 3; |
| 42 | 42 | |
| 43 | 43 | return $idExists === true ? |
| 44 | - static::createSuccessReply($value) : |
|
| 45 | - static::createErrorReply( |
|
| 44 | + static::createSuccessReply($value) : static::createErrorReply( |
|
| 46 | 45 | $context, |
| 47 | 46 | $value, |
| 48 | 47 | Errors::IS_VALID_SKU, |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Sample; |
| 4 | 4 | |
| 5 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
| 5 | +require_once __DIR__.'/vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * Copyright 2015-2019 [email protected] |