@@ -28,16 +28,16 @@ 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) { |
|
| 33 | - if(is_array($data)) { |
|
| 31 | + if ($validator === null) { |
|
| 32 | + $validator = function($data) { |
|
| 33 | + if (is_array($data)) { |
|
| 34 | 34 | return $this->isValidArray($data); |
| 35 | 35 | } |
| 36 | 36 | return (string) $data !== ''; |
| 37 | 37 | }; |
| 38 | 38 | } |
| 39 | - if($validationResultHandler === null) { |
|
| 40 | - $validationResultHandler = function () {}; |
|
| 39 | + if ($validationResultHandler === null) { |
|
| 40 | + $validationResultHandler = function() {}; |
|
| 41 | 41 | } |
| 42 | 42 | $this->validator = $validator; |
| 43 | 43 | $this->validationResultHandler = $validationResultHandler; |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | * @throws Exception |
| 76 | 76 | */ |
| 77 | 77 | private function buildKey($keyPath) { |
| 78 | - if(is_string($keyPath)) { |
|
| 78 | + if (is_string($keyPath)) { |
|
| 79 | 79 | $keyPath = explode('.', $keyPath); |
| 80 | 80 | } |
| 81 | - if(!is_array($keyPath)) { |
|
| 81 | + if (!is_array($keyPath)) { |
|
| 82 | 82 | throw new Exception('Invalid key'); |
| 83 | 83 | } |
| 84 | 84 | return $keyPath; |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | * @return bool |
| 90 | 90 | */ |
| 91 | 91 | private function isValidArray(array $array) { |
| 92 | - $data = array_filter($array, function ($value) { |
|
| 93 | - if(is_array($value)) { |
|
| 92 | + $data = array_filter($array, function($value) { |
|
| 93 | + if (is_array($value)) { |
|
| 94 | 94 | return $this->isValidArray($value); |
| 95 | 95 | } |
| 96 | 96 | return (string) $value !== ''; |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | if (!$count) { |
| 110 | 110 | return $default; |
| 111 | 111 | } |
| 112 | - for($idx = 0; $idx < $count; $idx++) { |
|
| 112 | + for ($idx = 0; $idx < $count; $idx++) { |
|
| 113 | 113 | $part = $path[$idx]; |
| 114 | - if(!array_key_exists($part, $array)) { |
|
| 114 | + if (!array_key_exists($part, $array)) { |
|
| 115 | 115 | return $default; |
| 116 | 116 | } |
| 117 | 117 | $array = $array[$part]; |