mirror of
https://github.com/Combodo/iTop.git
synced 2026-07-19 21:26:40 +02:00
33 lines
664 B
PHP
33 lines
664 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Laminas\Stdlib;
|
|
|
|
use ArrayIterator;
|
|
use ArrayObject as PhpArrayObject;
|
|
use ReturnTypeWillChange;
|
|
|
|
use function array_reverse;
|
|
|
|
/**
|
|
* ArrayObject that acts as a stack with regards to iteration
|
|
*/
|
|
class ArrayStack extends PhpArrayObject
|
|
{
|
|
/**
|
|
* Retrieve iterator
|
|
*
|
|
* Retrieve an array copy of the object, reverse its order, and return an
|
|
* ArrayIterator with that reversed array.
|
|
*
|
|
* @return ArrayIterator
|
|
*/
|
|
#[ReturnTypeWillChange]
|
|
public function getIterator()
|
|
{
|
|
$array = $this->getArrayCopy();
|
|
return new ArrayIterator(array_reverse($array));
|
|
}
|
|
}
|