LimeSurvey API - Master branch

FormatterMandatory extends FormatterYnToBool
in package

This class is extending the FormatterYnToBool class to be able to have 'S' as a third option.

It is only needed for prop of type "mandatory"

Table of Contents

Methods

format()  : mixed|null
Cast y/n to boolean
apply()  : bool|string|null
Cast y/n to boolean while keeping 'S' as a third option
revert()  : mixed|string|null
if value is 'S' it will be returned, otherwise the parent revert function will be called

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

apply()

Cast y/n to boolean while keeping 'S' as a third option

protected apply(string|null $value) : bool|string|null

Converts 'Y' or 'y' to boolean true. Converts 'N' or 'n' to boolean false.

Parameters
$value : string|null
Return values
bool|string|null

revert()

if value is 'S' it will be returned, otherwise the parent revert function will be called

protected revert(mixed|null $value[, array<string|int, mixed> $config = [] ]) : mixed|string|null
Parameters
$value : mixed|null
$config : array<string|int, mixed> = []
Return values
mixed|string|null

        
On this page

Search results