HumHub Documentation (unofficial)

Factory
in package

Factory for centralize constraint initialization.

Table of Contents

Properties

$constraintMap  : array<string|int, mixed>
$errorContext  : int
$schemaStorage  : SchemaStorage
$uriRetriever  : UriRetriever
$checkMode  : int
$instanceCache  : array<string|int, ConstraintInterface>
$typeCheck  : array<string|int, TypeCheckInterface>

Methods

__construct()  : mixed
addConfig()  : mixed
Enable checkMode flags
createInstanceFor()  : ConstraintInterface|ObjectConstraint
Create a constraint instance for the given constraint name.
getConfig()  : int
Get checkMode option
getErrorContext()  : string
Get the error context
getSchemaStorage()  : mixed
getTypeCheck()  : mixed
getUriRetriever()  : UriRetrieverInterface
removeConfig()  : mixed
Disable checkMode flags
setConfig()  : mixed
Set config values
setConstraintClass()  : Factory
setErrorContext()  : mixed
Set the error context

Properties

$constraintMap

protected array<string|int, mixed> $constraintMap = array('array' => 'JsonSchema\Constraints\CollectionConstraint', 'collection' => 'JsonSchema\Constraints\CollectionConstraint', 'object' => 'JsonSchema\Constraints\ObjectConstraint', 'type' => 'JsonSchema\Constraints\TypeConstraint', 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint', 'string' => 'JsonSchema\Constraints\StringConstraint', 'number' => 'JsonSchema\Constraints\NumberConstraint', 'enum' => 'JsonSchema\Constraints\EnumConstraint', 'format' => 'JsonSchema\Constraints\FormatConstraint', 'schema' => 'JsonSchema\Constraints\SchemaConstraint', 'validator' => 'JsonSchema\Validator')

$errorContext

protected int $errorContext = \JsonSchema\Validator::ERROR_DOCUMENT_VALIDATION

Validation context

$checkMode

private int $checkMode = \JsonSchema\Constraints\Constraint::CHECK_MODE_NORMAL

Methods

addConfig()

Enable checkMode flags

public addConfig(int $options) : mixed
Parameters
$options : int

getConfig()

Get checkMode option

public getConfig([int $options = null ]) : int
Parameters
$options : int = null

Options to get, if null then return entire bitmask

Return values
int

getErrorContext()

Get the error context

public getErrorContext() : string
Return values
string

getSchemaStorage()

public getSchemaStorage() : mixed

getTypeCheck()

public getTypeCheck() : mixed

removeConfig()

Disable checkMode flags

public removeConfig(int $options) : mixed
Parameters
$options : int

setConfig()

Set config values

public setConfig([int $checkMode = Constraint::CHECK_MODE_NORMAL ]) : mixed
Parameters
$checkMode : int = Constraint::CHECK_MODE_NORMAL

Set checkMode options - does not preserve existing flags

setConstraintClass()

public setConstraintClass(string $name, string $class) : Factory
Parameters
$name : string
$class : string
Return values
Factory

setErrorContext()

Set the error context

public setErrorContext(mixed $errorContext) : mixed
Parameters
$errorContext : mixed

        
On this page

Search results