Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SearchResultIterator.php
Go to the documentation of this file.
1 <?php
7 
8 class SearchResultIterator implements \Iterator
9 {
13  protected $items;
14 
18  public function __construct(
19  array $items
20  ) {
21  $this->items = $items;
22  }
23 
27  public function current()
28  {
29  return current($this->items);
30  }
31 
35  public function key()
36  {
37  return key($this->items);
38  }
39 
43  public function next()
44  {
45  next($this->items);
46  }
47 
51  public function rewind()
52  {
53  reset($this->items);
54  }
55 
59  public function valid()
60  {
61  return $this->key() !== null;
62  }
63 }