function BaseConstraint::addError
14 calls to BaseConstraint::addError()
- CollectionConstraint::check in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ CollectionConstraint.php - invokes the validation of an element
- CollectionConstraint::validateItems in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ CollectionConstraint.php - Validates the items
- EnumConstraint::check in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ EnumConstraint.php - invokes the validation of an element
- FormatConstraint::check in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ FormatConstraint.php - invokes the validation of an element
- NumberConstraint::check in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ NumberConstraint.php - invokes the validation of an element
File
-
vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ BaseConstraint.php, line 46
Class
- BaseConstraint
- A more basic constraint definition - used for the public interface to avoid exposing library internals.
Namespace
JsonSchema\ConstraintsCode
public function addError(?JsonPointer $path, $message, $constraint = '', ?array $more = null) {
$error = array(
'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
'message' => $message,
'constraint' => $constraint,
'context' => $this->factory
->getErrorContext(),
);
if ($this->factory
->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
}
if (is_array($more) && count($more) > 0) {
$error += $more;
}
$this->errors[] = $error;
$this->errorMask |= $error['context'];
}