A multiple iterator can have default values.

When the multiple iterator has the MIT_NEED_ANY flags, and when one of
the attached iterators has reached its end, the return value is NULL. We
change this behavior by allowing a different default value.

Example with no default value:

    $it = new \Hoa\Iterator\Multiple(
        \MultipleIterator::MIT_NEED_ANY
      | \MultipleIterator::MIT_KEYS_ASSOC
    );
    $it->attachIterator(new \ArrayIterator(['a', 'b', 'c']), 'foo');
    $it->attachIterator(new \ArrayIterator(['x']),           'bar');

    foreach($it as $value)
        echo $value['foo'], ' => ', $value['bar'], "\n";

    /**
     * Will output:
     *     a => x
     *     b =>
     *     c =>
     */

Example with 42 as a default value:

    $it->attachIterator(new \ArrayIterator(['a', 'b', 'c']), 'foo', 42);
    $it->attachIterator(new \ArrayIterator(['x']),           'bar', 42);

    foreach($it as $value)
        echo $value['foo'], ' => ', $value['bar'], "\n";

    /**
     * Will output:
     *     a => x
     *     b => 42
     *     c => 42
     */

It is clearly useful when one of the iterators returns an array, used
directly in a loop. To avoid a “NULL pointer exception”, we can specify
an empty array as a default value.
[auto] Merge from Iterator

    • #59dcff7 — A multiple iterator can have default values. (Ivan Enderlin, 2013-05-13)

---

Merge remote branch 'library-iterator/master'