@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | try { |
58 | 58 | $parsedValue = $this->parser->parse($rawValue); |
59 | 59 | } catch (ParsingException $exception) { |
60 | - throw new HydratingException([ $this->key => $exception->getInnerError() ]); |
|
60 | + throw new HydratingException([$this->key => $exception->getInnerError()]); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $this->validate($parsedValue, $object); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $validator->validate($parsedValue, $contextObject); |
79 | 79 | } |
80 | 80 | } catch (ValidationException $exception) { |
81 | - throw new HydratingException([ $this->key => $exception->getInnerError() ]); |
|
81 | + throw new HydratingException([$this->key => $exception->getInnerError()]); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | * @param string $key |
42 | 42 | * @param ParserInterface $parser |
43 | 43 | * @param ValidatorInterface[] $validators |
44 | - * @param mixed $default |
|
44 | + * @param mixed $defaultValue |
|
45 | 45 | */ |
46 | 46 | public function __construct(string $key, ParserInterface $parser, array $validators = [], $defaultValue = null) |
47 | 47 | { |
@@ -102,7 +102,7 @@ |
||
102 | 102 | */ |
103 | 103 | protected function findGetterMethod(ReflectionClass $reflectionClass, string $field) |
104 | 104 | { |
105 | - foreach ($reflectionClass->getMethods($this->ignoreProtected ? ReflectionMethod::IS_PUBLIC|ReflectionMethod::IS_PROTECTED|ReflectionMethod::IS_PRIVATE : ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { |
|
105 | + foreach ($reflectionClass->getMethods($this->ignoreProtected ? ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED | ReflectionMethod::IS_PRIVATE : ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { |
|
106 | 106 | if (!$reflectionMethod->isStatic() |
107 | 107 | && $reflectionMethod->getNumberOfRequiredParameters() == 0 |
108 | 108 | && strcasecmp($reflectionMethod->getName(), "get$field") == 0) { |
@@ -85,7 +85,7 @@ |
||
85 | 85 | */ |
86 | 86 | protected function findSetterMethod(ReflectionClass $reflectionClass, string $field) |
87 | 87 | { |
88 | - foreach ($reflectionClass->getMethods($this->ignoreProtected ? ReflectionMethod::IS_PUBLIC|ReflectionMethod::IS_PROTECTED|ReflectionMethod::IS_PRIVATE : ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { |
|
88 | + foreach ($reflectionClass->getMethods($this->ignoreProtected ? ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED | ReflectionMethod::IS_PRIVATE : ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { |
|
89 | 89 | if (!$reflectionMethod->isStatic() |
90 | 90 | && $reflectionMethod->getNumberOfRequiredParameters() == 1 |
91 | 91 | && strcasecmp($reflectionMethod->getName(), "set$field") == 0) { |
@@ -104,7 +104,7 @@ |
||
104 | 104 | $validator->validate($parsedValue, $contextObject); |
105 | 105 | } |
106 | 106 | } catch (ValidationException $exception) { |
107 | - throw new HydratingException([ $this->key => $exception->getInnerError() ]); |
|
107 | + throw new HydratingException([$this->key => $exception->getInnerError()]); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | /** @var string */ |
21 | 21 | private $className; |
22 | - public function getClassName() { return $this->className;} |
|
22 | + public function getClassName() { return $this->className; } |
|
23 | 23 | public function setClassName(string $className) { $this->className = $className; } |
24 | 24 | |
25 | 25 | /** @var Hydrator */ |
@@ -19,7 +19,7 @@ |
||
19 | 19 | if ($rawValue === null || $rawValue === '') { |
20 | 20 | return null; |
21 | 21 | } |
22 | - if(!is_float($rawValue) && !is_int($rawValue) && !is_numeric($rawValue)) { |
|
22 | + if (!is_float($rawValue) && !is_int($rawValue) && !is_numeric($rawValue)) { |
|
23 | 23 | $this->throw(); |
24 | 24 | } |
25 | 25 | return floatval($rawValue); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function __construct($errorsMap, $message = "", $code = 412) |
26 | 26 | { |
27 | 27 | $errorMessages = $this->getErrorMessage($errorsMap); |
28 | - $message .= "Detailed errors : \n " . implode(", ", $errorMessages); |
|
28 | + $message .= "Detailed errors : \n ".implode(", ", $errorMessages); |
|
29 | 29 | parent::__construct($message, $code, null); |
30 | 30 | $this->errorsMap = $errorsMap; |
31 | 31 | } |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | private function getErrorMessage($errorsMap, $parentField = 'root') |
34 | 34 | { |
35 | 35 | $errorMessages = []; |
36 | - foreach ($errorsMap as $field => $error){ |
|
37 | - $completeField = $parentField . '.' . $field; |
|
38 | - if (is_array($error)){ |
|
36 | + foreach ($errorsMap as $field => $error) { |
|
37 | + $completeField = $parentField.'.'.$field; |
|
38 | + if (is_array($error)) { |
|
39 | 39 | $innerError = $this->getErrorMessage($error, $completeField); |
40 | 40 | $errorMessages = array_merge($errorMessages, $innerError); |
41 | - }else if ($error !== null){ |
|
42 | - $errorMessages[] = $completeField . " : " . $error; |
|
41 | + } else if ($error !== null) { |
|
42 | + $errorMessages[] = $completeField." : ".$error; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | return $errorMessages; |
@@ -38,7 +38,7 @@ |
||
38 | 38 | if (is_array($error)){ |
39 | 39 | $innerError = $this->getErrorMessage($error, $completeField); |
40 | 40 | $errorMessages = array_merge($errorMessages, $innerError); |
41 | - }else if ($error !== null){ |
|
41 | + } else if ($error !== null){ |
|
42 | 42 | $errorMessages[] = $completeField . " : " . $error; |
43 | 43 | } |
44 | 44 | } |