Filter
extends Stream
in package
Class \Hoa\Stream\Filter.
Proposes some methods to handle filter.
Tags
Table of Contents
Constants
- DO_NOT_OVERWRITE = false
- Do not overwrite filter if already exists.
- OVERWRITE = true
- Overwrite filter if already exists.
- READ = STREAM_FILTER_READ
- Filter should only be applied when reading.
- READ_AND_WRITE = STREAM_FILTER_ALL
- Filter should be applied when reading and writing.
- WRITE = STREAM_FILTER_WRITE
- Filter should only be applied when writing.
Properties
- $_resources : array<string|int, mixed>
- All resources with at least one filter registered.
Methods
- append() : resource
- Append a filter to the list of filters.
- getRegistered() : array<string|int, mixed>
- Get all registered filer names.
- isRegistered() : bool
- Check if a filter is already registered or not.
- prepend() : resource
- Prepend a filter to the list of filters.
- register() : bool
- Register a stream filter.
- remove() : bool
- Delete a filter.
Constants
DO_NOT_OVERWRITE
Do not overwrite filter if already exists.
public
mixed
DO_NOT_OVERWRITE
= false
Tags
OVERWRITE
Overwrite filter if already exists.
public
mixed
OVERWRITE
= true
Tags
READ
Filter should only be applied when reading.
public
mixed
READ
= STREAM_FILTER_READ
Tags
READ_AND_WRITE
Filter should be applied when reading and writing.
public
mixed
READ_AND_WRITE
= STREAM_FILTER_ALL
Tags
WRITE
Filter should only be applied when writing.
public
mixed
WRITE
= STREAM_FILTER_WRITE
Tags
Properties
$_resources
All resources with at least one filter registered.
protected
static array<string|int, mixed>
$_resources
= []
Methods
append()
Append a filter to the list of filters.
public
static append(mixed $stream, string $name[, int $mode = self::READ ][, mixed $parameters = null ]) : resource
Parameters
- $stream : mixed
-
Stream which received the filter. Should be resource or an object of kind
Hoa\Stream
. - $name : string
-
Filter name.
- $mode : int = self::READ
-
self::READ
,self::WRITE
orself::READ_AND_WRITE
. - $parameters : mixed = null
-
Parameters.
Return values
resourcegetRegistered()
Get all registered filer names.
public
static getRegistered() : array<string|int, mixed>
Return values
array<string|int, mixed>isRegistered()
Check if a filter is already registered or not.
public
static isRegistered(string $name) : bool
Parameters
- $name : string
-
Filter name.
Return values
boolprepend()
Prepend a filter to the list of filters.
public
static prepend(mixed $stream, string $name[, int $mode = self::READ ][, mixed $parameters = null ]) : resource
Parameters
- $stream : mixed
-
Stream which received the filter. Should be resource or an object \Hoa\Stream.
- $name : string
-
Filter name.
- $mode : int = self::READ
-
self::READ, self::WRITE or self::READ_AND_WRITE.
- $parameters : mixed = null
-
Parameters.
Return values
resourceregister()
Register a stream filter.
public
static register(string $name, mixed $class[, bool $overwrite = self::DO_NOT_OVERWRITE ]) : bool
Parameters
- $name : string
-
Filter name.
- $class : mixed
-
Class name or instance.
- $overwrite : bool = self::DO_NOT_OVERWRITE
-
Overwrite filter if already exists or not. Given by self::*OVERWRITE constants.
Tags
Return values
boolremove()
Delete a filter.
public
static remove(mixed $streamFilter) : bool
Parameters
- $streamFilter : mixed
-
Stream filter resource or name.