HumHub Documentation (unofficial)

FormatConstraint extends Constraint
in package

Validates against the "format" property

Tags
author

Justin Rainbow justin.rainbow@gmail.com

see
http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.23

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

$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.
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
validateColor()  : mixed
validateDateTime()  : mixed
validateHostname()  : mixed
validatePhone()  : mixed
validateRegex()  : mixed
validateStyle()  : mixed

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

$errorMask

protected int $errorMask = \JsonSchema\Validator::ERROR_NONE

All error types which have occurred

$errors

protected array<string|int, mixed> $errors = array()

Errors

$inlineSchemaProperty

protected mixed $inlineSchemaProperty = '$schema'

Methods

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
object

check()

invokes the validation of an element

public check(mixed &$element[, mixed $schema = null ][, JsonPointer $path = null ][, mixed $i = null ]) : mixed
Parameters
$element : mixed
$schema : mixed = null
$path : JsonPointer = null
$i : mixed = null

getErrorMask()

Get the error mask

public getErrorMask() : int
Return values
int

getErrors()

public getErrors([mixed $errorContext = Validator::ERROR_ALL ]) : mixed
Parameters
$errorContext : mixed = Validator::ERROR_ALL

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

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

incrementPath()

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
@return

JsonPointer;

validateColor()

protected validateColor(mixed $color) : mixed
Parameters
$color : mixed

validateDateTime()

protected validateDateTime(mixed $datetime, mixed $format) : mixed
Parameters
$datetime : mixed
$format : mixed

validateHostname()

protected validateHostname(mixed $host) : mixed
Parameters
$host : mixed

validatePhone()

protected validatePhone(mixed $phone) : mixed
Parameters
$phone : mixed

validateRegex()

protected validateRegex(mixed $regex) : mixed
Parameters
$regex : mixed

validateStyle()

protected validateStyle(mixed $style) : mixed
Parameters
$style : mixed

        
On this page

Search results