Hoa central
Multiple.php
Go to the documentation of this file.
1 <?php
2 
37 namespace Hoa\Iterator;
38 
47 class Multiple extends \MultipleIterator
48 {
54  protected $_infos = [];
55 
56 
57 
68  public function attachIterator(
69  \Iterator $iterator,
70  $infos = null,
71  $default = null
72  ) {
73  $out = parent::attachIterator($iterator, $infos);
74 
75  if (null === $infos) {
76  $this->_infos[] = $default;
77  } else {
78  $this->_infos[$infos] = $default;
79  }
80 
81  return $out;
82  }
83 
89  public function current()
90  {
91  $out = parent::current();
92 
93  foreach ($out as $key => &$value) {
94  if (null === $value) {
95  $value = $this->_infos[$key];
96  }
97  }
98 
99  return $out;
100  }
101 }
attachIterator(\Iterator $iterator, $infos=null, $default=null)
Definition: Multiple.php:68