class JsonEncode extends Mutator (View source)

Encode a value into a JSON string.

Throws an exception if the value cannot be encoded.

Methods

__construct(int $flags = 0, int $depth = 512)

No description

mixed
__invoke(mixed $value)

Mutate the input value.

from  Mutator
static JsonEncode
make(int $flags = 0, int $depth = 512)

No description

mixed
mutate(mixed $value)

Mutate the input value.

static JsonEncode
pretty(int $flags = 0, int $depth = 512)

No description

Details

__construct(int $flags = 0, int $depth = 512)

No description

Parameters

int $flags

Bitmask of JSON encode options. Forces use of JSON_THROW_ON_ERROR (default: 0)

int $depth

The maximum depth (default: 512)

final mixed __invoke(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static JsonEncode make(int $flags = 0, int $depth = 512)

No description

Parameters

int $flags

Bitmask of JSON encode options. Forces use of JSON_THROW_ON_ERROR (default: 0)

int $depth

The maximum depth (default: 512)

Return Value

JsonEncode

mixed mutate(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static JsonEncode pretty(int $flags = 0, int $depth = 512)

No description

Parameters

int $flags

Bitmask of JSON encode options. Forces use of JSON_THROW_ON_ERROR and JSON_PRETTY_PRINT (default: 0)

int $depth

The maximum depth (default: 512)

Return Value

JsonEncode