@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | if (!$count) { |
| 29 | 29 | return $default; |
| 30 | 30 | } |
| 31 | - foreach($arrayPath as $idxValue) { |
|
| 31 | + foreach ($arrayPath as $idxValue) { |
|
| 32 | 32 | $part = $idxValue; |
| 33 | - if(!array_key_exists($part, $data)) { |
|
| 33 | + if (!array_key_exists($part, $data)) { |
|
| 34 | 34 | return $default; |
| 35 | 35 | } |
| 36 | 36 | $data = $data[$part]; |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | private static function _recursiveHas($structure, array $path): bool { |
| 47 | 47 | $data = self::ensureArrayIsArray($structure); |
| 48 | - if($data === null) { |
|
| 48 | + if ($data === null) { |
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | - if(!count($path)) { |
|
| 51 | + if (!count($path)) { |
|
| 52 | 52 | return false; |
| 53 | 53 | } |
| 54 | 54 | $key = array_shift($path); |
| 55 | - if(count($path)) { |
|
| 55 | + if (count($path)) { |
|
| 56 | 56 | return self::_recursiveHas($data[$key] ?? null, $path); |
| 57 | 57 | } |
| 58 | 58 | return array_key_exists($key, $data); |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | * @return string[] |
| 64 | 64 | */ |
| 65 | 65 | private static function getArrayPath($path): array { |
| 66 | - if(is_array($path)) { |
|
| 66 | + if (is_array($path)) { |
|
| 67 | 67 | return $path; |
| 68 | 68 | } |
| 69 | 69 | $parts = preg_split('{(?<!\\x5C)(?:\\x5C\\x5C)*\\.}', $path); |
| 70 | - if($parts === false) { |
|
| 70 | + if ($parts === false) { |
|
| 71 | 71 | return [$path]; |
| 72 | 72 | } |
| 73 | 73 | return $parts; |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | * @return array<mixed, mixed> |
| 79 | 79 | */ |
| 80 | 80 | private static function ensureArrayIsArray($array): ?array { |
| 81 | - if($array instanceof ArrayObject) { |
|
| 81 | + if ($array instanceof ArrayObject) { |
|
| 82 | 82 | return $array->getArrayCopy(); |
| 83 | 83 | } |
| 84 | - if(is_object($array)) { |
|
| 84 | + if (is_object($array)) { |
|
| 85 | 85 | return (array) $array; |
| 86 | 86 | } |
| 87 | - if(is_array($array)) { |
|
| 87 | + if (is_array($array)) { |
|
| 88 | 88 | return $array; |
| 89 | 89 | } |
| 90 | 90 | return null; |