| Conditions | 4 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function validate($value, $parameter, Validator $validator) |
||
| 18 | { |
||
| 19 | Assert::type($parameter, 'boolean', self::KEYWORD, $validator->getSchemaPath()); |
||
| 20 | |||
| 21 | if (!is_array($value) || $parameter === false) { |
||
| 22 | return null; |
||
| 23 | } |
||
| 24 | |||
| 25 | if (count($value) === count(array_unique(array_map('serialize', $value)))) { |
||
| 26 | return null; |
||
| 27 | } |
||
| 28 | |||
| 29 | return error('The array must be unique.', $validator); |
||
| 30 | } |
||
| 31 | } |
||
| 32 |