Chris@2: , Sebastian Heuer , Sebastian Bergmann Chris@2: * Chris@2: * For the full copyright and license information, please view the LICENSE Chris@2: * file that was distributed with this source code. Chris@2: */ Chris@2: Chris@2: namespace PharIo\Manifest; Chris@2: Chris@2: class AuthorCollectionIterator implements \Iterator { Chris@2: /** Chris@2: * @var Author[] Chris@2: */ Chris@2: private $authors = []; Chris@2: Chris@2: /** Chris@2: * @var int Chris@2: */ Chris@2: private $position; Chris@2: Chris@2: public function __construct(AuthorCollection $authors) { Chris@2: $this->authors = $authors->getAuthors(); Chris@2: } Chris@2: Chris@2: public function rewind() { Chris@2: $this->position = 0; Chris@2: } Chris@2: Chris@2: /** Chris@2: * @return bool Chris@2: */ Chris@2: public function valid() { Chris@2: return $this->position < count($this->authors); Chris@2: } Chris@2: Chris@2: /** Chris@2: * @return int Chris@2: */ Chris@2: public function key() { Chris@2: return $this->position; Chris@2: } Chris@2: Chris@2: /** Chris@2: * @return Author Chris@2: */ Chris@2: public function current() { Chris@2: return $this->authors[$this->position]; Chris@2: } Chris@2: Chris@2: public function next() { Chris@2: $this->position++; Chris@2: } Chris@2: }