Caster
in package
Helper for filtering out properties in casters.
Tags
Table of Contents
- EXCLUDE_DYNAMIC = 4
- EXCLUDE_EMPTY = 128
- EXCLUDE_NOT_IMPORTANT = 256
- EXCLUDE_NULL = 64
- EXCLUDE_PRIVATE = 32
- EXCLUDE_PROTECTED = 16
- EXCLUDE_PUBLIC = 8
- EXCLUDE_STRICT = 512
- EXCLUDE_VERBOSE = 1
- EXCLUDE_VIRTUAL = 2
- PREFIX_DYNAMIC = "\x00+\x00"
- PREFIX_PROTECTED = "\x00*\x00"
- PREFIX_VIRTUAL = "\x00~\x00"
- castObject() : array<string|int, mixed>
- Casts objects to arrays and adds the dynamic property prefix.
- castPhpIncompleteClass() : array<string|int, mixed>
- filter() : array<string|int, mixed>
- Filters out the specified properties.
Constants
EXCLUDE_DYNAMIC
public
mixed
EXCLUDE_DYNAMIC
= 4
EXCLUDE_EMPTY
public
mixed
EXCLUDE_EMPTY
= 128
EXCLUDE_NOT_IMPORTANT
public
mixed
EXCLUDE_NOT_IMPORTANT
= 256
EXCLUDE_NULL
public
mixed
EXCLUDE_NULL
= 64
EXCLUDE_PRIVATE
public
mixed
EXCLUDE_PRIVATE
= 32
EXCLUDE_PROTECTED
public
mixed
EXCLUDE_PROTECTED
= 16
EXCLUDE_PUBLIC
public
mixed
EXCLUDE_PUBLIC
= 8
EXCLUDE_STRICT
public
mixed
EXCLUDE_STRICT
= 512
EXCLUDE_VERBOSE
public
mixed
EXCLUDE_VERBOSE
= 1
EXCLUDE_VIRTUAL
public
mixed
EXCLUDE_VIRTUAL
= 2
PREFIX_DYNAMIC
public
mixed
PREFIX_DYNAMIC
= "\x00+\x00"
PREFIX_PROTECTED
public
mixed
PREFIX_PROTECTED
= "\x00*\x00"
PREFIX_VIRTUAL
public
mixed
PREFIX_VIRTUAL
= "\x00~\x00"
Methods
castObject()
Casts objects to arrays and adds the dynamic property prefix.
public
static castObject(object $obj, string $class[, bool $hasDebugInfo = false ]) : array<string|int, mixed>
Parameters
- $obj : object
- $class : string
- $hasDebugInfo : bool = false
-
Whether the __debugInfo method exists on $obj or not
Return values
array<string|int, mixed> —The array-cast of the object, with prefixed dynamic properties
castPhpIncompleteClass()
public
static castPhpIncompleteClass(__PHP_Incomplete_Class $c, array<string|int, mixed> $a, Stub $stub, bool $isNested) : array<string|int, mixed>
Parameters
- $c : __PHP_Incomplete_Class
- $a : array<string|int, mixed>
- $stub : Stub
- $isNested : bool
Return values
array<string|int, mixed> —filter()
Filters out the specified properties.
public
static filter(array<string|int, mixed> $a, int $filter[, array<string|int, string> $listedProperties = [] ], int &$count) : array<string|int, mixed>
By default, a single match in the $filter bit field filters properties out, following an "or" logic. When EXCLUDE_STRICT is set, an "and" logic is applied: all bits must match for a property to be removed.
Parameters
- $a : array<string|int, mixed>
-
The array containing the properties to filter
- $filter : int
-
A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out
- $listedProperties : array<string|int, string> = []
-
List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set
- $count : int
-
Set to the number of removed properties
Return values
array<string|int, mixed> —The filtered array