4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\VarDumper\Caster;
14 use Symfony\Component\VarDumper\Cloner\Stub;
17 * Casts a caster's Stub.
19 * @author Nicolas Grekas <p@tchwork.com>
23 public static function castStub(Stub $c, array $a, Stub $stub, $isNested)
26 $stub->type = $c->type;
27 $stub->class = $c->class;
28 $stub->value = $c->value;
29 $stub->handle = $c->handle;
36 public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNested)
38 return $isNested ? $c->preservedSubset : $a;
41 public static function cutInternals($obj, array $a, Stub $stub, $isNested)
44 $stub->cut += count($a);
52 public static function castEnum(EnumStub $c, array $a, Stub $stub, $isNested)
62 foreach (array_keys($c->value) as $k) {
63 $keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k;
65 // Preserve references with array_combine()
66 $a = array_combine($keys, $c->value);