FormatterMandatory
extends FormatterYnToBool
in package
This class is extending the FormatterYnToBool class in revert mode to be able to translate null value to 'S'.
It is only needed for prop of type "mandatory"
Table of Contents
Properties
- $lowercaseCase : bool
- $revert : bool
- $name : string
Methods
- __construct() : mixed
- format() : mixed|null
- Cast y/n to boolean
- setClassBasedOnConfig() : void
- Checks config for this specific formatter, and adjusts class properties based on the config.
- setName() : void
- apply() : bool|null
- Cast y/n to boolean
- revert() : mixed|null
- if parent revert function returns null, 'S' is returned
Properties
$lowercaseCase
public
bool
$lowercaseCase
= false
$revert
public
bool
$revert
= false
$name
private
string
$name
= 'mandatory'
Methods
__construct()
public
__construct([bool $revert = false ]) : mixed
Parameters
- $revert : bool = false
format()
Cast y/n to boolean
public
format(mixed|null $value, array<string|int, mixed> $config[, array<string|int, mixed> $options = [] ]) : mixed|null
Parameters
- $value : mixed|null
- $config : array<string|int, mixed>
- $options : array<string|int, mixed> = []
Return values
mixed|nullsetClassBasedOnConfig()
Checks config for this specific formatter, and adjusts class properties based on the config.
public
setClassBasedOnConfig(array<string|int, mixed> $config) : void
Parameters
- $config : array<string|int, mixed>
setName()
public
setName(string $name) : void
Parameters
- $name : string
apply()
Cast y/n to boolean
protected
apply(string|null $value) : bool|null
Converts 'Y' or 'y' to boolean true. Converts 'N' or 'n' to boolean false. Any other value will produce null.
Parameters
- $value : string|null
Return values
bool|nullrevert()
if parent revert function returns null, 'S' is returned
protected
revert(mixed|null $value) : mixed|null
Parameters
- $value : mixed|null