UndefinedConstraint
extends Constraint
in package
The UndefinedConstraint Constraints
Tags
Attributes
- #[AllowDynamicProperties]
Table of Contents
Constants
- CHECK_MODE_APPLY_DEFAULTS = 0x8
- CHECK_MODE_COERCE_TYPES = 0x4
- CHECK_MODE_DISABLE_FORMAT = 0x20
- CHECK_MODE_EXCEPTIONS = 0x10
- CHECK_MODE_NONE = 0x0
- CHECK_MODE_NORMAL = 0x1
- CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x80
- CHECK_MODE_TYPE_CAST = 0x2
- CHECK_MODE_VALIDATE_SCHEMA = 0x100
Properties
- $appliedDefaults : array<string|int, mixed>
- $errorMask : int
- $errors : array<string|int, mixed>
- $factory : Factory
- $inlineSchemaProperty : mixed
Methods
- __construct() : mixed
- addError() : mixed
- addErrors() : mixed
- arrayToObjectRecursive() : object
- Recursively cast an associative array to an object
- check() : mixed
- invokes the validation of an element
- getErrorMask() : int
- Get the error mask
- getErrors() : mixed
- isValid() : mixed
- numErrors() : mixed
- reset() : mixed
- Clears any reported errors. Should be used between multiple validation checks.
- validateTypes() : mixed
- Validates the value against the types
- applyDefaultValues() : mixed
- Apply default values
- checkArray() : mixed
- Validates an array
- checkEnum() : mixed
- Checks a enum element
- checkFormat() : mixed
- Checks format of an element
- checkNumber() : mixed
- Checks a number element
- checkObject() : mixed
- Validates an object
- checkString() : mixed
- Checks a string element
- checkType() : mixed
- Validates the type of a property
- checkUndefined() : mixed
- Checks a undefined element
- convertJsonPointerIntoPropertyPath() : string
- getTypeCheck() : TypeCheckInterface
- Get the type check based on the set check mode.
- incrementPath() : mixed
- Bubble down the path
- validateCommonProperties() : mixed
- Validates common properties
- validateDependencies() : mixed
- Validate dependencies
- validateOfProperties() : mixed
- Validate allOf, anyOf, and oneOf properties
- validateUri() : mixed
- shouldApplyDefaultValue() : bool
- Check whether a default should be applied for this value
Constants
CHECK_MODE_APPLY_DEFAULTS
public
mixed
CHECK_MODE_APPLY_DEFAULTS
= 0x8
CHECK_MODE_COERCE_TYPES
public
mixed
CHECK_MODE_COERCE_TYPES
= 0x4
CHECK_MODE_DISABLE_FORMAT
public
mixed
CHECK_MODE_DISABLE_FORMAT
= 0x20
CHECK_MODE_EXCEPTIONS
public
mixed
CHECK_MODE_EXCEPTIONS
= 0x10
CHECK_MODE_NONE
public
mixed
CHECK_MODE_NONE
= 0x0
CHECK_MODE_NORMAL
public
mixed
CHECK_MODE_NORMAL
= 0x1
CHECK_MODE_ONLY_REQUIRED_DEFAULTS
public
mixed
CHECK_MODE_ONLY_REQUIRED_DEFAULTS
= 0x80
CHECK_MODE_TYPE_CAST
public
mixed
CHECK_MODE_TYPE_CAST
= 0x2
CHECK_MODE_VALIDATE_SCHEMA
public
mixed
CHECK_MODE_VALIDATE_SCHEMA
= 0x100
Properties
$appliedDefaults
protected
array<string|int, mixed>
$appliedDefaults
= array()
List of properties to which a default value has been applied
$errorMask
protected
int
$errorMask
= \JsonSchema\Validator::ERROR_NONE
All error types which have occurred
$errors
protected
array<string|int, mixed>
$errors
= array()
Errors
$factory
protected
Factory
$factory
$inlineSchemaProperty
protected
mixed
$inlineSchemaProperty
= '$schema'
Methods
__construct()
public
__construct([Factory $factory = null ]) : mixed
Parameters
- $factory : Factory = null
addError()
public
addError([JsonPointer $path = null ], mixed $message[, mixed $constraint = '' ][, array<string|int, mixed> $more = null ]) : mixed
Parameters
- $path : JsonPointer = null
- $message : mixed
- $constraint : mixed = ''
- $more : array<string|int, mixed> = null
addErrors()
public
addErrors(array<string|int, mixed> $errors) : mixed
Parameters
- $errors : array<string|int, mixed>
arrayToObjectRecursive()
Recursively cast an associative array to an object
public
static arrayToObjectRecursive(array<string|int, mixed> $array) : object
Parameters
- $array : array<string|int, mixed>
Return values
objectcheck()
invokes the validation of an element
public
check(mixed &$value[, mixed $schema = null ][, JsonPointer $path = null ][, mixed $i = null ][, mixed $fromDefault = false ]) : mixed
Parameters
- $value : mixed
- $schema : mixed = null
- $path : JsonPointer = null
- $i : mixed = null
- $fromDefault : mixed = false
getErrorMask()
Get the error mask
public
getErrorMask() : int
Return values
intgetErrors()
public
getErrors([mixed $errorContext = Validator::ERROR_ALL ]) : mixed
Parameters
- $errorContext : mixed = Validator::ERROR_ALL
isValid()
public
isValid() : mixed
numErrors()
public
numErrors([mixed $errorContext = Validator::ERROR_ALL ]) : mixed
Parameters
- $errorContext : mixed = Validator::ERROR_ALL
reset()
Clears any reported errors. Should be used between multiple validation checks.
public
reset() : mixed
validateTypes()
Validates the value against the types
public
validateTypes(mixed &$value, mixed $schema, JsonPointer $path[, string $i = null ]) : mixed
Parameters
- $value : mixed
- $schema : mixed
- $path : JsonPointer
- $i : string = null
applyDefaultValues()
Apply default values
protected
applyDefaultValues(mixed &$value, mixed $schema, JsonPointer $path) : mixed
Parameters
- $value : mixed
- $schema : mixed
- $path : JsonPointer
checkArray()
Validates an array
protected
checkArray(mixed &$value[, mixed $schema = null ][, JsonPointer|null $path = null ][, mixed $i = null ]) : mixed
Parameters
- $value : mixed
- $schema : mixed = null
- $path : JsonPointer|null = null
- $i : mixed = null
checkEnum()
Checks a enum element
protected
checkEnum(mixed $value[, mixed $schema = null ][, JsonPointer|null $path = null ][, mixed $i = null ]) : mixed
Parameters
- $value : mixed
- $schema : mixed = null
- $path : JsonPointer|null = null
- $i : mixed = null
checkFormat()
Checks format of an element
protected
checkFormat(mixed $value[, mixed $schema = null ][, JsonPointer|null $path = null ][, mixed $i = null ]) : mixed
Parameters
- $value : mixed
- $schema : mixed = null
- $path : JsonPointer|null = null
- $i : mixed = null
checkNumber()
Checks a number element
protected
checkNumber(mixed $value[, mixed $schema = null ][, JsonPointer $path = null ][, mixed $i = null ]) : mixed
Parameters
- $value : mixed
- $schema : mixed = null
- $path : JsonPointer = null
- $i : mixed = null
checkObject()
Validates an object
protected
checkObject(mixed &$value[, mixed $schema = null ][, JsonPointer|null $path = null ][, mixed $properties = null ][, mixed $additionalProperties = null ][, mixed $patternProperties = null ][, mixed $appliedDefaults = array() ]) : mixed
Parameters
- $value : mixed
- $schema : mixed = null
- $path : JsonPointer|null = null
- $properties : mixed = null
- $additionalProperties : mixed = null
- $patternProperties : mixed = null
- $appliedDefaults : mixed = array()
checkString()
Checks a string element
protected
checkString(mixed $value[, mixed $schema = null ][, JsonPointer|null $path = null ][, mixed $i = null ]) : mixed
Parameters
- $value : mixed
- $schema : mixed = null
- $path : JsonPointer|null = null
- $i : mixed = null
checkType()
Validates the type of a property
protected
checkType(mixed &$value[, mixed $schema = null ][, JsonPointer|null $path = null ][, mixed $i = null ]) : mixed
Parameters
- $value : mixed
- $schema : mixed = null
- $path : JsonPointer|null = null
- $i : mixed = null
checkUndefined()
Checks a undefined element
protected
checkUndefined(mixed &$value[, mixed $schema = null ][, JsonPointer|null $path = null ][, mixed $i = null ][, mixed $fromDefault = false ]) : mixed
Parameters
- $value : mixed
- $schema : mixed = null
- $path : JsonPointer|null = null
- $i : mixed = null
- $fromDefault : mixed = false
convertJsonPointerIntoPropertyPath()
protected
convertJsonPointerIntoPropertyPath(JsonPointer $pointer) : string
Parameters
- $pointer : JsonPointer
Return values
string —property path
getTypeCheck()
Get the type check based on the set check mode.
protected
getTypeCheck() : TypeCheckInterface
Return values
TypeCheckInterfaceincrementPath()
Bubble down the path
protected
incrementPath([JsonPointer|null $path = null ], mixed $i) : mixed
Parameters
- $path : JsonPointer|null = null
-
Current path
- $i : mixed
-
What to append to the path
Tags
validateCommonProperties()
Validates common properties
protected
validateCommonProperties(mixed &$value, mixed $schema, JsonPointer $path[, string $i = '' ]) : mixed
Parameters
- $value : mixed
- $schema : mixed
- $path : JsonPointer
- $i : string = ''
validateDependencies()
Validate dependencies
protected
validateDependencies(mixed $value, mixed $dependencies, JsonPointer $path[, string $i = '' ]) : mixed
Parameters
- $value : mixed
- $dependencies : mixed
- $path : JsonPointer
- $i : string = ''
validateOfProperties()
Validate allOf, anyOf, and oneOf properties
protected
validateOfProperties(mixed &$value, mixed $schema, JsonPointer $path[, string $i = '' ]) : mixed
Parameters
- $value : mixed
- $schema : mixed
- $path : JsonPointer
- $i : string = ''
validateUri()
protected
validateUri(mixed $schema[, mixed $schemaUri = null ]) : mixed
Parameters
- $schema : mixed
- $schemaUri : mixed = null
shouldApplyDefaultValue()
Check whether a default should be applied for this value
private
shouldApplyDefaultValue(bool $requiredOnly, mixed $schema[, mixed $name = null ][, mixed $parentSchema = null ]) : bool
Parameters
- $requiredOnly : bool
- $schema : mixed
- $name : mixed = null
- $parentSchema : mixed = null