Caster
class Caster
Helper for filtering out properties in casters.
Constants
EXCLUDE_VERBOSE | |
EXCLUDE_VIRTUAL | |
EXCLUDE_DYNAMIC | |
EXCLUDE_PUBLIC | |
EXCLUDE_PROTECTED | |
EXCLUDE_PRIVATE | |
EXCLUDE_NULL | |
EXCLUDE_EMPTY | |
EXCLUDE_NOT_IMPORTANT | |
EXCLUDE_STRICT | |
PREFIX_VIRTUAL | |
PREFIX_DYNAMIC | |
PREFIX_PROTECTED |
Methods
static array | castObject(object $obj, string $class, bool $hasDebugInfo = false) Casts objects to arrays and adds the dynamic property prefix. | |
static array | filter(array $a, int $filter, array $listedProperties = array(), int $count = 0) Filters out the specified properties. | |
static | castPhpIncompleteClass(__PHP_Incomplete_Class $c, array $a, Stub $stub, $isNested) |
Details
static array castObject(object $obj, string $class, bool $hasDebugInfo = false)
Casts objects to arrays and adds the dynamic property prefix.
Parameters
object | $obj | The object to cast |
string | $class | The class of the object |
bool | $hasDebugInfo | Whether the __debugInfo method exists on $obj or not |
Return Value
array | The array-cast of the object, with prefixed dynamic properties |
static array filter(array $a, int $filter, array $listedProperties = array(), int $count = 0)
Filters out the specified properties.
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
array | $a | The array containing the properties to filter |
int | $filter | A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out |
array | $listedProperties | List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set |
int | $count | &$count Set to the number of removed properties |
Return Value
array | The filtered array |
static castPhpIncompleteClass(__PHP_Incomplete_Class $c, array $a, Stub $stub, $isNested)
Parameters
__PHP_Incomplete_Class | $c | |
array | $a | |
Stub | $stub | |
$isNested |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/VarDumper/Caster/Caster.html