@@ -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 () {}; |
|
| 36 | + if ($validationResultHandler === null) { |
|
| 37 | + $validationResultHandler = function() {}; |
|
| 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]; |