@@ 65-67 (lines=3) @@ | ||
62 | ||
63 | $listCheck = self::isList($structure); |
|
64 | if (!$listCheck) { |
|
65 | if (count($data) > 0 && self::isList($data)) { |
|
66 | throw new ValidatorException(sprintf('Unexpected list structure (%s elements found) in %s', count($data), self::getStructurePath($path))); |
|
67 | } |
|
68 | ||
69 | $diff = array_diff_key($data, $structure); |
|
70 | if (count($diff) > 0) { |
|
@@ 79-81 (lines=3) @@ | ||
76 | throw new ValidatorException(sprintf('Missing keys (%s) in %s', implode(', ', array_keys($diff)), self::getStructurePath($path))); |
|
77 | } |
|
78 | ||
79 | } elseif (count($data) > 0 && !self::isList($data)) { |
|
80 | throw new ValidatorException(sprintf('Expected list structure in %s', self::getStructurePath($path))); |
|
81 | } |
|
82 | ||
83 | foreach ($data as $key => $value) { |
|
84 | try { |