/** * @param \ArrayIterator $map */ public function __construct(\ArrayIterator $map) { $this->map = $map; parent::__construct($this->map, function ($element) use($map) { return array($map->key(), $element); }); }
public function __construct(\SplObjectStorage $map) { $this->map = $map; $keyFinder = function ($key) { return $key instanceof NotObjectKey ? $key->key : $key; }; parent::__construct($this->map, function ($key) use($keyFinder, $map) { return array($keyFinder($key), $map[$key]); }); }
public function __construct(Pairs $pairs, $part) { if (!in_array($part, array(static::PART_KEY, static::PART_ELEMENT))) { throw new \InvalidArgumentException('Unknown part.'); } $this->pairs = $pairs; parent::__construct($this->pairs, function ($pair) use($part) { return $pair[$part]; }); }
public function rewind() { $this->flattingIterator->rewind(); $this->iterator = $this->prepareCurrentIterator()->orElse(new \ArrayIterator(array())); parent::rewind(); }