eloquent/endec API
Class

Eloquent\Endec\Encoder

class Encoder implements EncoderInterface

A general-purpose encoder implementation for composing custom encoders.

Methods

__construct(TransformInterface $encodeTransform)

Construct a new encoder.

TransformInterface encodeTransform()

Get the encode transform.

string encode(string $data)

Encode the supplied data.

TransformStreamInterface createEncodeStream(integer|null $bufferSize = null)

Create a new encode stream.

Details

at line 28
public __construct(TransformInterface $encodeTransform)

Construct a new encoder.

Parameters

TransformInterface $encodeTransform The encode transform to use.

at line 38
public TransformInterface encodeTransform()

Get the encode transform.

Return Value

TransformInterface The encode transform.

at line 51
public string encode(string $data)

Encode the supplied data.

Parameters

string $data The data to encode.

Return Value

string The encoded data.

Exceptions

EncodingExceptionInterface If the data cannot be encoded.

at line 70
public TransformStreamInterface createEncodeStream(integer|null $bufferSize = null)

Create a new encode stream.

Parameters

integer|null $bufferSize The buffer size in bytes.

Return Value

TransformStreamInterface The newly created encode stream.