Documentation

JsonEncode
in package
implements EncoderInterface

Encodes JSON data.

Tags
author

Sander Coolen sander@jibber.nl

Table of Contents

Interfaces

EncoderInterface

Constants

OPTIONS  = 'json_encode_options'

Properties

$defaultContext  : mixed

Methods

__construct()  : mixed
encode()  : string
Encodes data into the given format.
supportsEncoding()  : bool
Checks whether the serializer can encode to given format.

Constants

OPTIONS

public mixed OPTIONS = 'json_encode_options'

Properties

$defaultContext

private mixed $defaultContext = [self::OPTIONS => 0]

Methods

__construct()

public __construct([array<string|int, mixed> $defaultContext = [] ]) : mixed
Parameters
$defaultContext : array<string|int, mixed> = []

encode()

Encodes data into the given format.

public encode(mixed $data, string $format[, array<string|int, mixed> $context = [] ]) : string
Parameters
$data : mixed

Data to encode

$format : string

Format name

$context : array<string|int, mixed> = []

Options that normalizers/encoders have access to

Return values
string

supportsEncoding()

Checks whether the serializer can encode to given format.

public supportsEncoding(string $format) : bool
Parameters
$format : string

Format name

Return values
bool

        
On this page

Search results