Boolean
extends DataType
in package
A boolean value Internally uses boolean
Table of Contents
- $validators : array<string|int, callable>
- $value : mixed
- __construct() : mixed
- The constructor is normally called from the DataObject when instatiated.
- __toString() : string
- converts true to 1 and false to 0
- equals() : mixed
- Compares the boolean value
- in() : mixed
- Stores the $value as boolean casting it
- out() : mixed
- Returns the $value applying the output filters
- raw() : mixed
- Returns the value without processing it
- validate() : true
- Runs all registered validators
- value() : mixed
- Returns the internal value
Properties
$validators
protected
array<string|int, callable>
$validators
= []
An array of functions that are executed on validation
$value
protected
mixed
$value
The internal value of the DataType
Methods
__construct()
The constructor is normally called from the DataObject when instatiated.
public
__construct([mixde $value = null ][, array<string|int, mixed> $props = [] ]) : mixed
Inside the constructor the validator callables are generated and saved in the $validators member
When a concrete implementation of DataType is written, make sure to call the parent constructor
to have the validators in place
Parameters
- $value : mixde = null
- $props : array<string|int, mixed> = []
-
The properties for the standard validators
Return values
mixed —__toString()
converts true to 1 and false to 0
public
__toString() : string
Return values
string —equals()
Compares the boolean value
public
equals(mixed $compare) : mixed
Parameters
- $compare : mixed
-
The value to be compared
Return values
mixed —in()
Stores the $value as boolean casting it
public
in(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —out()
Returns the $value applying the output filters
public
out() : mixed
This method should be overwritten in the concrete implementation
Tags
Return values
mixed —raw()
Returns the value without processing it
public
raw() : mixed
Tags
Return values
mixed —validate()
Runs all registered validators
public
validate() : true
Tags
Return values
true —if validations was succsessful
value()
Returns the internal value
public
value() : mixed