function ReflectionCaster::castClass
File
-
vendor/
symfony/ var-dumper/ Caster/ ReflectionCaster.php, line 168
Class
- ReflectionCaster
- Casts Reflector related classes to array representation.
Namespace
Symfony\Component\VarDumper\CasterCode
public static function castClass(\ReflectionClass $c, array $a, Stub $stub, bool $isNested, int $filter = 0) : array {
$prefix = Caster::PREFIX_VIRTUAL;
if ($n = \Reflection::getModifierNames($c->getModifiers())) {
$a[$prefix . 'modifiers'] = implode(' ', $n);
}
self::addMap($a, $c, [
'extends' => 'getParentClass',
'implements' => 'getInterfaceNames',
'constants' => 'getReflectionConstants',
]);
foreach ($c->getProperties() as $n) {
$a[$prefix . 'properties'][$n->name] = $n;
}
foreach ($c->getMethods() as $n) {
$a[$prefix . 'methods'][$n->name] = $n;
}
self::addAttributes($a, $c, $prefix);
if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) {
self::addExtra($a, $c);
}
return $a;
}