@@ -41,7 +41,7 @@ |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * @return mixed |
|
| 44 | + * @return string |
|
| 45 | 45 | */ |
| 46 | 46 | public function getExpression() { |
| 47 | 47 | return $this->expression; |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | $this->value = $data; |
| 29 | 29 | $this->keyPath = $this->buildKey($keyPath); |
| 30 | 30 | $this->value = $this->recursiveGet($data, $this->keyPath, null); |
| 31 | - if($validator === null) { |
|
| 32 | - $validator = function ($data) { |
|
| 31 | + if ($validator === null) { |
|
| 32 | + $validator = function($data) { |
|
| 33 | 33 | return (string) $data !== ''; |
| 34 | 34 | }; |
| 35 | 35 | } |
| 36 | - if($validationResultHandler === null) { |
|
| 37 | - $validationResultHandler = function ($data) {}; |
|
| 36 | + if ($validationResultHandler === null) { |
|
| 37 | + $validationResultHandler = function($data) {}; |
|
| 38 | 38 | } |
| 39 | 39 | $this->validator = $validator; |
| 40 | 40 | $this->validationResultHandler = $validationResultHandler; |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | * @throws Exception |
| 73 | 73 | */ |
| 74 | 74 | private function buildKey($keyPath) { |
| 75 | - if(is_string($keyPath)) { |
|
| 75 | + if (is_string($keyPath)) { |
|
| 76 | 76 | $keyPath = explode('.', $keyPath); |
| 77 | 77 | } |
| 78 | - if(!is_array($keyPath)) { |
|
| 78 | + if (!is_array($keyPath)) { |
|
| 79 | 79 | throw new Exception('Invalid key'); |
| 80 | 80 | } |
| 81 | 81 | return $keyPath; |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | if (!$count) { |
| 93 | 93 | return $default; |
| 94 | 94 | } |
| 95 | - for($idx = 0; $idx < $count; $idx++) { |
|
| 95 | + for ($idx = 0; $idx < $count; $idx++) { |
|
| 96 | 96 | $part = $path[$idx]; |
| 97 | - if(!array_key_exists($part, $array)) { |
|
| 97 | + if (!array_key_exists($part, $array)) { |
|
| 98 | 98 | return $default; |
| 99 | 99 | } |
| 100 | 100 | $array = $array[$part]; |
@@ -27,8 +27,8 @@ |
||
| 27 | 27 | * @return DBExprFilter |
| 28 | 28 | */ |
| 29 | 29 | public function __invoke($expression, $keyPath, $validator = null) { |
| 30 | - return new DBExprFilter($expression, $this->map, $keyPath, $validator, function ($result, array $data) { |
|
| 31 | - if(!$result) { |
|
| 30 | + return new DBExprFilter($expression, $this->map, $keyPath, $validator, function($result, array $data) { |
|
| 31 | + if (!$result) { |
|
| 32 | 32 | throw new RequiredValueNotFoundException(sprintf("Required value %s not found", $data['key'])); |
| 33 | 33 | } |
| 34 | 34 | }); |