Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BaseConstraint.php

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

... See full list

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\Constraints

Code

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'];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal