eloquent/confetti API
Class

Eloquent\Confetti\CompoundTransform

class CompoundTransform implements CompoundTransformInterface, BufferedTransformInterface

A transform that combines several other transforms in sequence.

Methods

__construct(array $transforms)

Construct a new compound transform.

array<TransformInterface> transforms()

Get the sequence of transforms that are applied to incoming data.

integer bufferSize()

Get the buffer size.

tuple<string,integer,mixed> transform(string $data, mixed $context, boolean $isEnd = false)

Transform the supplied data.

Details

at line 27
public __construct(array $transforms)

Construct a new compound transform.

Parameters

array $transforms The sequence of transforms to apply to incoming data.

at line 38
public array<TransformInterface> transforms()

Get the sequence of transforms that are applied to incoming data.

Return Value

array<TransformInterface> The transforms.

at line 55
public integer bufferSize()

Get the buffer size.

This method is used to determine how much input is typically required before output can be produced. This can provide performance benefits by avoiding excessive method calls.

Return Value

integer The buffer size.

at line 85
public tuple<string,integer,mixed> transform(string $data, mixed $context, boolean $isEnd = false)

Transform the supplied data.

This method may transform only part of the supplied data. The return value includes information about how much data was actually consumed. The transform can be forced to consume all data by passing a boolean true as the $isEnd argument.

The $context argument will initially be null, but any value assigned to this variable will persist until the stream transformation is complete. It can be used as a place to store state, such as a buffer.

It is guaranteed that this method will be called with $isEnd = true once, and only once, at the end of the stream transformation.

Parameters

string $data The data to transform.
mixed $context An arbitrary context value.
boolean $isEnd True if all supplied data must be transformed.

Return Value

tuple<string,integer,mixed> A 3-tuple of the transformed data, the number of bytes consumed, and any resulting error.