LimeSurvey API - Master branch

FormatterYnToBool
in package
implements FormatterInterface

Table of Contents

Interfaces

FormatterInterface

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
Cast boolean to y/n

Properties

Methods

__construct()

public __construct([bool $revert = false ][, bool $lowercase = false ]) : mixed
Parameters
$revert : bool = false
$lowercase : 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

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|null

setClassBasedOnConfig()

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>

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|null

revert()

Cast boolean to y/n

protected revert(mixed|null $value) : mixed|null

Converts boolean true 'y'. Converts boolean false to 'n'. Any other value will produce null.

Parameters
$value : mixed|null
Return values
mixed|null

        
On this page

Search results