COAR Notify
 
Loading...
Searching...
No Matches
coarnotify\validate\Validators Class Reference

Static Public Member Functions

static absolueURI ($obj, $uri)
 
static url ($obj, $url)
 
static oneOf (array $values)
 
static atLeastOneOf (array $values)
 
static contains ($value)
 
static typeChecker ($obj, $value)
 

Detailed Description

Class to wrap a library of validators. Provided this way as a convenient way to pass functions by reference to the validation configuration

Member Function Documentation

◆ absolueURI()

static coarnotify\validate\Validators::absolueURI ( $obj,
$uri )
static

Validate that the given string is an absolute URI

Parameters
$obj
$uri
Returns
true
Exceptions
ValueError

◆ atLeastOneOf()

static coarnotify\validate\Validators::atLeastOneOf ( array $values)
static

Closure that returns a validation function that checks that a list of values contains at least one of the given values

Parameters
array$values
Returns
\Closure

◆ contains()

static coarnotify\validate\Validators::contains ( $value)
static

Closure that returns a validation function that checks the provided values contain the required value

Parameters
$value
Returns
\Closure

◆ oneOf()

static coarnotify\validate\Validators::oneOf ( array $values)
static

Closure that returns a validation function that checks that the value is one of the given values

Parameters
array$values
Returns
\Closure

◆ typeChecker()

static coarnotify\validate\Validators::typeChecker ( $obj,
$value )
static

Validate that the given value is of the correct type for the object. The exact behaviour of this function depends on the object provided:

  • If the object has an ALLOWED_TYPES attribute which is not an empty list, then the value must be one of the types in that list
  • If the object has a TYPE attribute, then the value must be, or contain, that type
  • In all other cases, type validation will succeed
Parameters
$obj
$value
Returns
true

◆ url()

static coarnotify\validate\Validators::url ( $obj,
$url )
static

Validate that the given string is an absolute HTTP URI (i.e. a URL)

Parameters
$obj
$url
Returns
true
Exceptions
ValueError

The documentation for this class was generated from the following file: