Encoder
in
Tags
Table of Contents
Methods
- canEncode() : bool
- Checks if the encoder supports a given value.
- encode() : mixed
- Encodes a given value. If the encoder does not support the value, it should throw an exception.
- encodeIfSupported() : mixed
- Encodes a given value if supported, otherwise returns the value as-is.
Methods
canEncode()
Checks if the encoder supports a given value.
public
canEncode(mixed $value) : bool
Parameters
- $value : mixed
Tags
Return values
boolencode()
Encodes a given value. If the encoder does not support the value, it should throw an exception.
public
encode(mixed $value) : mixed
Parameters
- $value : mixed
Tags
encodeIfSupported()
Encodes a given value if supported, otherwise returns the value as-is.
public
encodeIfSupported(mixed $value) : mixed
The EncodeIfSupported trait provides a default implementation of this method.
Parameters
- $value : mixed