Serializable.php 723 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace RocketTheme\Toolbox\ArrayTraits;
  3. /**
  4. * Implements \Serializable interface.
  5. *
  6. * @package RocketTheme\Toolbox\ArrayTraits
  7. * @author RocketTheme
  8. * @license MIT
  9. *
  10. * @property array $items
  11. */
  12. trait Serializable
  13. {
  14. /**
  15. * Returns string representation of the object.
  16. *
  17. * @return string Returns the string representation of the object.
  18. */
  19. public function serialize()
  20. {
  21. return serialize($this->items);
  22. }
  23. /**
  24. * Called during unserialization of the object.
  25. *
  26. * @param string $serialized The string representation of the object.
  27. */
  28. public function unserialize($serialized)
  29. {
  30. $this->items = unserialize($serialized);
  31. }
  32. }