StubCaster.php 984 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\VarDumper\Caster;
  11. use Symfony\Component\VarDumper\Cloner\Stub;
  12. /**
  13. * Casts a caster's Stub.
  14. *
  15. * @author Nicolas Grekas <p@tchwork.com>
  16. */
  17. class StubCaster
  18. {
  19. public static function castStub(Stub $c, array $a, Stub $stub, $isNested)
  20. {
  21. if ($isNested) {
  22. $stub->type = $c->type;
  23. $stub->class = $c->class;
  24. $stub->value = $c->value;
  25. $stub->handle = $c->handle;
  26. $stub->cut = $c->cut;
  27. return array();
  28. }
  29. }
  30. public static function cutInternals($obj, array $a, Stub $stub, $isNested)
  31. {
  32. if ($isNested) {
  33. $stub->cut += count($a);
  34. return array();
  35. }
  36. return $a;
  37. }
  38. }