You are here

class SplStack in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-stdlib/src/SplStack.php \Zend\Stdlib\SplStack

Serializable version of SplStack

Hierarchy

  • class \Zend\Stdlib\SplStack implements \Serializable
    • class \Zend\Stdlib\SplStack implements \Serializable

Expanded class hierarchy of SplStack

1 string reference to 'SplStack'
DoublerSpec::its_double_mirrors_alterates_and_instantiates_provided_class in vendor/phpspec/prophecy/spec/Prophecy/Doubler/DoublerSpec.php

File

vendor/zendframework/zend-stdlib/src/SplStack.php, line 17

Namespace

Zend\Stdlib
View source
class SplStack extends \SplStack implements Serializable {

  /**
   * Serialize to an array representing the stack
   *
   * @return array
   */
  public function toArray() {
    $array = [];
    foreach ($this as $item) {
      $array[] = $item;
    }
    return $array;
  }

  /**
   * Serialize
   *
   * @return string
   */
  public function serialize() {
    return serialize($this
      ->toArray());
  }

  /**
   * Unserialize
   *
   * @param  string $data
   * @return void
   */
  public function unserialize($data) {
    foreach (unserialize($data) as $item) {
      $this
        ->unshift($item);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SplStack::serialize public function Serialize Overrides SplStack::serialize 1
SplStack::toArray public function Serialize to an array representing the stack Overrides SplStack::toArray 1
SplStack::unserialize public function Unserialize Overrides SplStack::unserialize 1