PHP Interface Symfony\Component\Serializer\SerializerInterface

Author: Jordi Boggiano ([email protected])
Show file Open project: pmjones/php-framework-benchmarks Interface Usage Examples

Public Methods

Method Description
decode ( string $data, string $format ) : mixed Decodes a string from the given format back into PHP data
denormalize ( mixed $data, string $type, string $format = null ) : mixed Denormalizes data into the given type.
deserialize ( mixed $data, string $type, string $format ) Deserializes data into the given type.
encode ( mixed $data, string $format ) : array | scalar Encodes data into the given format
getEncoder ( $format ) : Symfony\Component\Serializer\Encoder\EncoderInterface Get the encoder for the given format
normalize ( mixed $data, string $format = null ) : array | scalar Normalizes any data into a set of arrays/scalars
serialize ( mixed $data, string $format ) : string Serializes data in the appropriate format
supportsDecoding ( string $format ) : boolean Checks whether the serializer can decode from given format
supportsDeserialization ( string $format ) : boolean Checks whether the serializer can deserialize from given format
supportsEncoding ( string $format ) : boolean Checks whether the serializer can encode to given format
supportsSerialization ( string $format ) : boolean Checks whether the serializer can serialize to given format

Method Details

decode() public method

Decodes a string from the given format back into PHP data
public decode ( string $data, string $format ) : mixed
$data string data to decode
$format string format name
return mixed

denormalize() public method

Denormalizes data into the given type.
public denormalize ( mixed $data, string $type, string $format = null ) : mixed
$data mixed
$type string
$format string
return mixed

deserialize() public method

Deserializes data into the given type.
public deserialize ( mixed $data, string $type, string $format )
$data mixed
$type string
$format string

encode() public method

Encodes data into the given format
public encode ( mixed $data, string $format ) : array | scalar
$data mixed data to encode
$format string format name
return array | scalar

getEncoder() public method

Get the encoder for the given format
public getEncoder ( $format ) : Symfony\Component\Serializer\Encoder\EncoderInterface
return Symfony\Component\Serializer\Encoder\EncoderInterface

normalize() public method

Normalizes any data into a set of arrays/scalars
public normalize ( mixed $data, string $format = null ) : array | scalar
$data mixed data to normalize
$format string format name, present to give the option to normalizers to act differently based on formats
return array | scalar

serialize() public method

Serializes data in the appropriate format
public serialize ( mixed $data, string $format ) : string
$data mixed any data
$format string format name
return string

supportsDecoding() public method

Checks whether the serializer can decode from given format
public supportsDecoding ( string $format ) : boolean
$format string format name
return boolean

supportsDeserialization() public method

Checks whether the serializer can deserialize from given format
public supportsDeserialization ( string $format ) : boolean
$format string format name
return boolean

supportsEncoding() public method

Checks whether the serializer can encode to given format
public supportsEncoding ( string $format ) : boolean
$format string format name
return boolean

supportsSerialization() public method

Checks whether the serializer can serialize to given format
public supportsSerialization ( string $format ) : boolean
$format string format name
return boolean