Constants

CHECK_MODE_NONE

CHECK_MODE_NONE = 0

CHECK_MODE_NORMAL

CHECK_MODE_NORMAL = 1

CHECK_MODE_TYPE_CAST

CHECK_MODE_TYPE_CAST = 2

CHECK_MODE_COERCE_TYPES

CHECK_MODE_COERCE_TYPES = 4

CHECK_MODE_APPLY_DEFAULTS

CHECK_MODE_APPLY_DEFAULTS = 8

CHECK_MODE_EXCEPTIONS

CHECK_MODE_EXCEPTIONS = 16

CHECK_MODE_DISABLE_FORMAT

CHECK_MODE_DISABLE_FORMAT = 32

CHECK_MODE_ONLY_REQUIRED_DEFAULTS

CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 128

CHECK_MODE_VALIDATE_SCHEMA

CHECK_MODE_VALIDATE_SCHEMA = 256

Properties

$inlineSchemaProperty

$inlineSchemaProperty : 

Type

$errors

$errors : array

Type

array — Errors

$errorMask

$errorMask : integer

Type

integer — All error types which have occurred

$appliedDefaults

$appliedDefaults : array

Type

array — List of properties to which a default value has been applied

Methods

addError()

addError(\JsonSchema\Entity\JsonPointer  $path = null,   $message,   $constraint = '', array  $more = null) 

Parameters

\JsonSchema\Entity\JsonPointer $path
$message
$constraint
array $more

addErrors()

addErrors(array  $errors) 

Parameters

array $errors

getErrors()

getErrors(  $errorContext = \JsonSchema\Validator::ERROR_ALL) 

Parameters

$errorContext

numErrors()

numErrors(  $errorContext = \JsonSchema\Validator::ERROR_ALL) 

Parameters

$errorContext

isValid()

isValid() 

reset()

reset() 

Clears any reported errors. Should be used between multiple validation checks.

getErrorMask()

getErrorMask() : integer

Get the error mask

Returns

integer

arrayToObjectRecursive()

arrayToObjectRecursive(array  $array) : object

Recursively cast an associative array to an object

Parameters

array $array

Returns

object

check()

check(  $element,   $schema = null, \JsonSchema\Entity\JsonPointer  $path = null,   $properties = null,   $additionalProp = null,   $patternProperties = null,   $appliedDefaults = array()) 

{@inheritdoc}

Parameters

$element
$schema
\JsonSchema\Entity\JsonPointer $path
$properties
$additionalProp
$patternProperties
$appliedDefaults

validatePatternProperties()

validatePatternProperties(  $element, \JsonSchema\Entity\JsonPointer  $path = null,   $patternProperties) 

Parameters

$element
\JsonSchema\Entity\JsonPointer $path
$patternProperties

validateElement()

validateElement(\StdClass  $element, array  $matches, \StdClass  $schema = null, \JsonSchema\Entity\JsonPointer|null  $path = null, \StdClass  $properties = null, mixed  $additionalProp = null) 

Validates the element properties

Parameters

\StdClass $element

Element to validate

array $matches

Matches from patternProperties (if any)

\StdClass $schema

ObjectConstraint definition

\JsonSchema\Entity\JsonPointer|null $path

Current test path

\StdClass $properties

Properties

mixed $additionalProp

Additional properties

validateProperties()

validateProperties(\stdClass  $element, \stdClass  $properties = null, \JsonSchema\Entity\JsonPointer|null  $path = null) 

Validates the definition properties

Parameters

\stdClass $element

Element to validate

\stdClass $properties

Property definitions

\JsonSchema\Entity\JsonPointer|null $path

Path?

incrementPath()

incrementPath(\JsonSchema\Entity\JsonPointer|null  $path = null, mixed  $i) : \JsonSchema\Constraints\JsonPointer;

Bubble down the path

Parameters

\JsonSchema\Entity\JsonPointer|null $path

Current path

mixed $i

What to append to the path

Returns

\JsonSchema\Constraints\JsonPointer;

checkArray()

checkArray(mixed  $value, mixed  $schema = null, \JsonSchema\Entity\JsonPointer|null  $path = null, mixed  $i = null) 

Validates an array

Parameters

mixed $value
mixed $schema
\JsonSchema\Entity\JsonPointer|null $path
mixed $i

checkObject()

checkObject(mixed  $value, mixed  $schema = null, \JsonSchema\Entity\JsonPointer|null  $path = null, mixed  $properties = null, mixed  $additionalProperties = null, mixed  $patternProperties = null,   $appliedDefaults = array()) 

Validates an object

Parameters

mixed $value
mixed $schema
\JsonSchema\Entity\JsonPointer|null $path
mixed $properties
mixed $additionalProperties
mixed $patternProperties
$appliedDefaults

checkType()

checkType(mixed  $value, mixed  $schema = null, \JsonSchema\Entity\JsonPointer|null  $path = null, mixed  $i = null) 

Validates the type of a property

Parameters

mixed $value
mixed $schema
\JsonSchema\Entity\JsonPointer|null $path
mixed $i

checkUndefined()

checkUndefined(mixed  $value, mixed  $schema = null, \JsonSchema\Entity\JsonPointer|null  $path = null, mixed  $i = null,   $fromDefault = false) 

Checks a undefined element

Parameters

mixed $value
mixed $schema
\JsonSchema\Entity\JsonPointer|null $path
mixed $i
$fromDefault

checkString()

checkString(mixed  $value, mixed  $schema = null, \JsonSchema\Entity\JsonPointer|null  $path = null, mixed  $i = null) 

Checks a string element

Parameters

mixed $value
mixed $schema
\JsonSchema\Entity\JsonPointer|null $path
mixed $i

checkNumber()

checkNumber(mixed  $value, mixed  $schema = null, \JsonSchema\Entity\JsonPointer  $path = null, mixed  $i = null) 

Checks a number element

Parameters

mixed $value
mixed $schema
\JsonSchema\Entity\JsonPointer $path
mixed $i

checkEnum()

checkEnum(mixed  $value, mixed  $schema = null, \JsonSchema\Entity\JsonPointer|null  $path = null, mixed  $i = null) 

Checks a enum element

Parameters

mixed $value
mixed $schema
\JsonSchema\Entity\JsonPointer|null $path
mixed $i

checkFormat()

checkFormat(mixed  $value, mixed  $schema = null, \JsonSchema\Entity\JsonPointer|null  $path = null, mixed  $i = null) 

Checks format of an element

Parameters

mixed $value
mixed $schema
\JsonSchema\Entity\JsonPointer|null $path
mixed $i

convertJsonPointerIntoPropertyPath()

convertJsonPointerIntoPropertyPath(\JsonSchema\Entity\JsonPointer  $pointer) : string

Parameters

\JsonSchema\Entity\JsonPointer $pointer

Returns

string —

property path

getProperty()

getProperty(mixed  $element, string  $property, mixed  $fallback = null) : mixed

retrieves a property from an object or array

Parameters

mixed $element

Element to validate

string $property

Property to retrieve

mixed $fallback

Default value if property is not found

Returns

mixed

validateMinMaxConstraint()

validateMinMaxConstraint(\stdClass  $element, \stdClass  $objectDefinition, \JsonSchema\Entity\JsonPointer|null  $path = null) 

validating minimum and maximum property constraints (if present) against an element

Parameters

\stdClass $element

Element to validate

\stdClass $objectDefinition

ObjectConstraint definition

\JsonSchema\Entity\JsonPointer|null $path

Path to test?