4 * This file is part of the JsonSchema package.
6 * For the full copyright and license information, please view the LICENSE
7 * file that was distributed with this source code.
10 namespace JsonSchema\Constraints;
12 use JsonSchema\Entity\JsonPointer;
15 * The Constraints Interface
17 * @author Robert Schönthal <seroscho@googlemail.com>
19 interface ConstraintInterface
22 * returns all collected errors
26 public function getErrors();
29 * adds errors to this validator
31 * @param array $errors
33 public function addErrors(array $errors);
38 * @param JsonPointer|null $path
39 * @param string $message
40 * @param string $constraint the constraint/rule that is broken, e.g.: 'minLength'
41 * @param array $more more array elements to add to the error
43 public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
46 * checks if the validator has not raised errors
50 public function isValid();
53 * invokes the validation of an element
58 * @param mixed $schema
59 * @param JsonPointer|null $path
62 * @throws \JsonSchema\Exception\ExceptionInterface
64 public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);