FormatterIntToBool
in package
implements
FormatterInterface
Table of Contents
Interfaces
Methods
- format() : mixed|null
- Cast integer to boolean
- apply() : mixed|null
- Cast integer to boolean
- revert() : mixed|null
- Cast boolean to int
Methods
format()
Cast integer to boolean
public
format(mixed|null $value[, array<string|int, mixed> $config = [] ][, array<string|int, mixed> $options = [] ]) : mixed|null
Converts number greater than zero to boolean true. Converts number of zero or less to boolean false. Convert empty string to null. Null is passed through unchanged.
Parameters
- $value : mixed|null
- $config : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
Return values
mixed|nullapply()
Cast integer to boolean
protected
apply(mixed|null $value) : mixed|null
Converts number greater than zero to boolean true. Converts number of zero or less to boolean false. Convert empty string to null. Null is passed through unchanged.
Parameters
- $value : mixed|null
Return values
mixed|nullrevert()
Cast boolean to int
protected
revert(mixed|null $value) : mixed|null
Converts true'y to 1. Converts false'y to 0. Converts empty string to null. Null is passed through unchanged.
Parameters
- $value : mixed|null