| Total Complexity | 13 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class GridValidator |
||
| 10 | { |
||
| 11 | public static function gridIsValid(Grid $grid): bool |
||
| 14 | } |
||
| 15 | |||
| 16 | private static function rowsAreValid(Grid $grid): bool |
||
| 17 | { |
||
| 18 | for ($i = 0; $i < Grid::NUMBER_OF_ROWS; $i++) { |
||
| 19 | $row = $grid->getRow($i); |
||
| 20 | if (self::hasDuplicates($row)) { |
||
| 21 | return false; |
||
| 22 | } |
||
| 23 | } |
||
| 24 | |||
| 25 | return true; |
||
| 26 | } |
||
| 27 | |||
| 28 | private static function columnsAreValid(Grid $grid): bool |
||
| 37 | } |
||
| 38 | |||
| 39 | private static function blocksAreValid(Grid $grid): bool |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param int[] $values |
||
| 52 | * |
||
| 53 | * @return bool |
||
| 54 | */ |
||
| 55 | private static function hasDuplicates(array $values): bool |
||
| 60 | } |
||
| 61 | } |
||
| 62 |