|
19 | 19 | */ |
20 | 20 | class CollectionConstraint extends Constraint |
21 | 21 | { |
22 | | - |
23 | 22 | /** |
24 | | - * {@inheritDoc} |
| 23 | + * {@inheritdoc} |
25 | 24 | */ |
26 | 25 | public function check(&$value, $schema = null, JsonPointer $path = null, $i = null) |
27 | 26 | { |
28 | 27 | // Verify minItems |
29 | 28 | if (isset($schema->minItems) && count($value) < $schema->minItems) { |
30 | | - $this->addError($path, "There must be a minimum of " . $schema->minItems . " items in the array", 'minItems', array('minItems' => $schema->minItems,)); |
| 29 | + $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems)); |
31 | 30 | } |
32 | 31 |
|
33 | 32 | // Verify maxItems |
34 | 33 | if (isset($schema->maxItems) && count($value) > $schema->maxItems) { |
35 | | - $this->addError($path, "There must be a maximum of " . $schema->maxItems . " items in the array", 'maxItems', array('maxItems' => $schema->maxItems,)); |
| 34 | + $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems)); |
36 | 35 | } |
37 | 36 |
|
38 | 37 | // Verify uniqueItems |
39 | 38 | if (isset($schema->uniqueItems) && $schema->uniqueItems) { |
40 | 39 | $unique = $value; |
41 | 40 | if (is_array($value) && count($value)) { |
42 | | - $unique = array_map(function($e) { return var_export($e, true); }, $value); |
| 41 | + $unique = array_map(function ($e) { |
| 42 | + return var_export($e, true); |
| 43 | + }, $value); |
43 | 44 | } |
44 | 45 | if (count(array_unique($unique)) != count($value)) { |
45 | | - $this->addError($path, "There are no duplicates allowed in the array", 'uniqueItems'); |
| 46 | + $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems'); |
46 | 47 | } |
47 | 48 | } |
48 | 49 |
|
@@ -123,7 +124,7 @@ protected function validateItems(&$value, $schema = null, JsonPointer $path = nu |
123 | 124 | $this->checkUndefined($v, $schema->additionalItems, $path, $k); |
124 | 125 | } else { |
125 | 126 | $this->addError( |
126 | | - $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems,)); |
| 127 | + $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems)); |
127 | 128 | } |
128 | 129 | } else { |
129 | 130 | // Should be valid against an empty schema |
|
0 commit comments