Documentation

Caster
in package

Helper for filtering out properties in casters.

Tags
author

Nicolas Grekas p@tchwork.com

final

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  = "+"
PREFIX_PROTECTED  = "*"
PREFIX_VIRTUAL  = "~"
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 = "+"

PREFIX_PROTECTED

public mixed PREFIX_PROTECTED = "*"

PREFIX_VIRTUAL

public mixed PREFIX_VIRTUAL = "~"

Methods

castObject()

Casts objects to arrays and adds the dynamic property prefix.

public static castObject(object $obj, string $class[, bool $hasDebugInfo = false ][, string|null $debugClass = null ]) : array<string|int, mixed>
Parameters
$obj : object
$class : string
$hasDebugInfo : bool = false

Whether the __debugInfo method exists on $obj or not

$debugClass : string|null = null
Return values
array<string|int, mixed>

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|null &$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|null

Set to the number of removed properties

Return values
array<string|int, mixed>

Search results