[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/zendframework/zend-stdlib/src/ -> SplStack.php (source)

   1  <?php
   2  /**
   3   * Zend Framework (http://framework.zend.com/)
   4   *
   5   * @link      http://github.com/zendframework/zf2 for the canonical source repository
   6   * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
   7   * @license   http://framework.zend.com/license/new-bsd New BSD License
   8   */
   9  
  10  namespace Zend\Stdlib;
  11  
  12  use Serializable;
  13  
  14  /**
  15   * Serializable version of SplStack
  16   */
  17  class SplStack extends \SplStack implements Serializable
  18  {
  19      /**
  20       * Serialize to an array representing the stack
  21       *
  22       * @return array
  23       */
  24      public function toArray()
  25      {
  26          $array = array();
  27          foreach ($this as $item) {
  28              $array[] = $item;
  29          }
  30          return $array;
  31      }
  32  
  33      /**
  34       * Serialize
  35       *
  36       * @return string
  37       */
  38      public function serialize()
  39      {
  40          return serialize($this->toArray());
  41      }
  42  
  43      /**
  44       * Unserialize
  45       *
  46       * @param  string $data
  47       * @return void
  48       */
  49      public function unserialize($data)
  50      {
  51          foreach (unserialize($data) as $item) {
  52              $this->unshift($item);
  53          }
  54      }
  55  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1