Hoa central
Public Member Functions | Protected Attributes | List of all members
Hoa\Iterator\Multiple Class Reference
Inheritance diagram for Hoa\Iterator\Multiple:

Public Member Functions

 attachIterator (\Iterator $iterator, $infos=null, $default=null)
 
 current ()
 

Protected Attributes

 $_infos = []
 

Detailed Description

Class .

Extending the SPL MultipleIterator class.

Definition at line 47 of file Multiple.php.

Member Function Documentation

Hoa\Iterator\Multiple::attachIterator ( \Iterator  $iterator,
  $infos = null,
  $default = null 
)

Attach iterator informations. Add the $default argument that will be use when the iterator has reached its end.

Parameters
\Iterator$iteratorIterator.
string$infosInformations to attach.
mixed$defaultDefault value.
Returns
void

Definition at line 68 of file Multiple.php.

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  }
Hoa\Iterator\Multiple::current ( )

Get the registered iterator instances.

Returns
array

Definition at line 89 of file Multiple.php.

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  }

Member Data Documentation

Hoa\Iterator\Multiple::$_infos = []
protected

Definition at line 54 of file Multiple.php.


The documentation for this class was generated from the following file: