FormatterYnToBool
in package
implements
FormatterInterface
Table of Contents
Interfaces
Methods
- format() : mixed|null
- Cast y/n to boolean
- apply() : bool|string|null
- Cast y/n to boolean
- revert() : mixed|null
- Cast boolean to y/n
Methods
format()
Cast y/n to boolean
public
format(mixed|null $value[, array<string|int, mixed> $config = [] ][, array<string|int, mixed> $options = [] ]) : mixed|null
Converts 'Y' or 'y' to boolean true. Converts 'N' or 'n' to boolean false. Any other value will produce null.
Parameters
- $value : mixed|null
- $config : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
Return values
mixed|nullapply()
Cast y/n to boolean
protected
apply(string|null $value) : bool|string|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|string|nullrevert()
Cast boolean to y/n
protected
revert(mixed|null $value[, array<string|int, mixed> $config = [] ]) : mixed|null
Converts boolean true 'y'. Converts boolean false to 'n'. Any other value will produce null.
Parameters
- $value : mixed|null
- $config : array<string|int, mixed> = []