CustomFilter
extends LateComputed
in package
Class \Hoa\Stream\Filter\LateComputed.
A late computed filter computes the data when closing the filtering.
Table of Contents
Constants
- FATAL_ERROR = PSFS_ERR_FATAL
- The filter experienced and unrecoverable error and cannot continue.
- FEED_ME = PSFS_FEED_ME
- Filter processed successfully, however no data was available to return.
- FLAG_FLUSH_CLOSE = PSFS_FLAG_FLUSH_CLOSE
- Final flush prior to closing.
- FLAG_FLUSH_INC = PSFS_FLAG_FLUSH_INC
- An incremental flush.
- FLAG_NORMAL = PSFS_FLAG_NORMAL
- Regular read/write.
- PASS_ON = PSFS_PASS_ON
- Filter processed successfully with data available in the out bucket brigade.
Properties
- $_buffer : string
- Buffer.
Methods
- filter() : int
- Filter data.
- getName() : string
- Get the filter name.
- getParameters() : mixed
- Get the filter parameters.
- getStream() : resource
- Get the stream resource being filtered.
- onClose() : void
- Called upon filter shutdown (typically, this is also during stream shutdown), and is executed after the flush method is called.
- onCreate() : bool
- Called during instanciation of the filter class object.
- setName() : string
- Set the filter name.
- setParameters() : mixed
- Set the filter parameters.
- compute() : string
- Compute the whole data (stored in $this->_buffer).
Constants
FATAL_ERROR
The filter experienced and unrecoverable error and cannot continue.
public
mixed
FATAL_ERROR
= PSFS_ERR_FATAL
Tags
FEED_ME
Filter processed successfully, however no data was available to return.
public
mixed
FEED_ME
= PSFS_FEED_ME
More data is required from the stream or prior filter.
Tags
FLAG_FLUSH_CLOSE
Final flush prior to closing.
public
mixed
FLAG_FLUSH_CLOSE
= PSFS_FLAG_FLUSH_CLOSE
Tags
FLAG_FLUSH_INC
An incremental flush.
public
mixed
FLAG_FLUSH_INC
= PSFS_FLAG_FLUSH_INC
Tags
FLAG_NORMAL
Regular read/write.
public
mixed
FLAG_NORMAL
= PSFS_FLAG_NORMAL
Tags
PASS_ON
Filter processed successfully with data available in the out bucket brigade.
public
mixed
PASS_ON
= PSFS_PASS_ON
Tags
Properties
$_buffer
Buffer.
protected
string
$_buffer
= null
Methods
filter()
Filter data.
public
filter(resource $in, resource $out, int &$consumed, bool $closing) : int
This method is called whenever data is read from or written to the attach stream.
Parameters
- $in : resource
-
A resource pointing to a bucket brigade which contains one or more bucket objects containing data to be filtered.
- $out : resource
-
A resource pointing to a second bucket brigade into which your modified buckets should be replaced.
- $consumed : int
-
Which must always be declared by reference, should be incremented by the length of the data which your filter reads in and alters.
- $closing : bool
-
If the stream is in the process of closing (and therefore this is the last pass through the filterchain), the closing parameter will be set to true.
Return values
intgetName()
Get the filter name.
public
getName() : string
Return values
stringgetParameters()
Get the filter parameters.
public
getParameters() : mixed
getStream()
Get the stream resource being filtered.
public
getStream() : resource
Maybe available only during filter calls when the closing parameter is set to false.
Return values
resourceonClose()
Called upon filter shutdown (typically, this is also during stream shutdown), and is executed after the flush method is called.
public
onClose() : void
onCreate()
Called during instanciation of the filter class object.
public
onCreate() : bool
Return values
boolsetName()
Set the filter name.
public
setName(string $name) : string
Parameters
- $name : string
-
Filter name.
Return values
stringsetParameters()
Set the filter parameters.
public
setParameters(mixed $parameters) : mixed
Parameters
- $parameters : mixed
-
Filter parameters.
compute()
Compute the whole data (stored in $this->_buffer).
protected
compute() : string