Stub.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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\Cloner;
  11. /**
  12. * Represents the main properties of a PHP variable.
  13. *
  14. * @author Nicolas Grekas <p@tchwork.com>
  15. */
  16. class Stub
  17. {
  18. const TYPE_REF = 1;
  19. const TYPE_STRING = 2;
  20. const TYPE_ARRAY = 3;
  21. const TYPE_OBJECT = 4;
  22. const TYPE_RESOURCE = 5;
  23. const STRING_BINARY = 1;
  24. const STRING_UTF8 = 2;
  25. const ARRAY_ASSOC = 1;
  26. const ARRAY_INDEXED = 2;
  27. public $type = self::TYPE_REF;
  28. public $class = '';
  29. public $value;
  30. public $cut = 0;
  31. public $handle = 0;
  32. public $refCount = 0;
  33. public $position = 0;
  34. public $attr = [];
  35. /**
  36. * @internal
  37. */
  38. public function __sleep()
  39. {
  40. $this->serialized = [$this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr];
  41. return ['serialized'];
  42. }
  43. /**
  44. * @internal
  45. */
  46. public function __wakeup()
  47. {
  48. list($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr) = $this->serialized;
  49. unset($this->serialized);
  50. }
  51. }