Skip to content

Commit

Permalink
Pass a traversable directly.
Browse files Browse the repository at this point in the history
This allows applications to pass an existing iterator, and not necessarily having to implement the Iterator interface.
  • Loading branch information
yunosh committed May 5, 2017
1 parent 253bed7 commit cd4bc97
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions framework/Backup/lib/Horde/Backup/Collection.php
Expand Up @@ -13,20 +13,22 @@

namespace Horde\Backup;

use IteratorIterator;
use Traversable;

/**
* A collection of backup objects of a certain application-specific type.
*
* Each application should extend this class for each type of backup data it
* supports. The concrete class implementation must also implement the Iterator
* methods so that the backup data can be returned on demand.
* supports.
*
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @copyright 2017 Horde LLC
* @license http://www.horde.org/licenses/bsd BSD
* @package Backup
*/
abstract class Collection implements Iterator
abstract class Collection extends IteratorIterator
{
/**
* The collection's user.
Expand All @@ -40,8 +42,9 @@ abstract class Collection implements Iterator
*
* @param string $user A user name.
*/
public function __construct($user)
public function __construct(Traversable $iterator, $user)
{
parent::__construct($iterator);
$this->_user = $user;
}

Expand Down

0 comments on commit cd4bc97

Please sign in to comment.