| Conditions | 5 |
| Paths | 5 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | 6 | private function validate(array $data) |
|
| 33 | { |
||
| 34 | 6 | foreach ($data as $key => $row) { |
|
| 35 | 6 | if (!is_array($row)) { |
|
| 36 | 1 | throw new InvalidDataException(sprintf('Row #(%s) is not an array.', $key)); |
|
| 37 | } |
||
| 38 | 5 | $localKeys = array_keys($row); |
|
| 39 | 5 | sort($localKeys); |
|
| 40 | 5 | if (isset($keys)) { |
|
| 41 | 5 | if ($keys !== $localKeys) { |
|
| 42 | 1 | throw new InvalidDataException( |
|
| 43 | 1 | sprintf('Row #(%s) has different structure than the 1st element.', $key) |
|
| 44 | ); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | 5 | $keys = $localKeys; |
|
| 48 | } |
||
| 49 | 4 | } |
|
| 50 | |||
| 69 |