class BooleanEncoder implements Encoder (View source)

Encoder for boolean values.

Methods

array
getDefaultOptions()

Returns a list of options and their default values as an associative array.

bool
supports(mixed $value)

Tells if the encoder supports encoding the given value.

string
encode(mixed $value, int $depth, array $options, callable $encode)

Generates the PHP code representation for the given value.

Details

array getDefaultOptions()

Returns a list of options and their default values as an associative array.

Return Value

array List of options and their default values

bool supports(mixed $value)

Tells if the encoder supports encoding the given value.

Parameters

mixed $value Value to test

Return Value

bool True if the value can be encoded, false otherwise

string encode(mixed $value, int $depth, array $options, callable $encode)

Generates the PHP code representation for the given value.

Parameters

mixed $value Value to encode
int $depth Current indentation depth of the output
array $options List of encoder options
callable $encode Callback used to encode values

Return Value

string The PHP code that represents the given value