HumHub Documentation (unofficial)

ConstraintInterface

The Constraints Interface

Tags
author

Robert Schönthal seroscho@googlemail.com

Table of Contents

Methods

addError()  : mixed
adds an error
addErrors()  : mixed
adds errors to this validator
check()  : mixed
invokes the validation of an element
getErrors()  : array<string|int, mixed>
returns all collected errors
isValid()  : bool
checks if the validator has not raised errors

Methods

addError()

adds an error

public addError([JsonPointer|null $path = null ], string $message[, string $constraint = '' ][, array<string|int, mixed> $more = null ]) : mixed
Parameters
$path : JsonPointer|null = null
$message : string
$constraint : string = ''

the constraint/rule that is broken, e.g.: 'minLength'

$more : array<string|int, mixed> = null

more array elements to add to the error

addErrors()

adds errors to this validator

public addErrors(array<string|int, mixed> $errors) : mixed
Parameters
$errors : array<string|int, mixed>

check()

invokes the validation of an element

public check(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
Tags
abstract
throws
ExceptionInterface

getErrors()

returns all collected errors

public getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>

isValid()

checks if the validator has not raised errors

public isValid() : bool
Return values
bool

        
On this page

Search results