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;
38 public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNested)
40 return $isNested ? $c->preservedSubset : $a;
43 public static function cutInternals($obj, array $a, Stub $stub, $isNested)
46 $stub->cut += count($a);
54 public static function castEnum(EnumStub $c, array $a, Stub $stub, $isNested)
64 foreach (array_keys($c->value) as $k) {
65 $keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k;
67 // Preserve references with array_combine()
68 $a = array_combine($keys, $c->value);