Mercurial > hg > cmmr2012-drupal-site
annotate vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | 5311817fb629 |
children |
rev | line source |
---|---|
Chris@2 | 1 <?php |
Chris@2 | 2 /* |
Chris@2 | 3 * This file is part of PharIo\Manifest. |
Chris@2 | 4 * |
Chris@2 | 5 * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> |
Chris@2 | 6 * |
Chris@2 | 7 * For the full copyright and license information, please view the LICENSE |
Chris@2 | 8 * file that was distributed with this source code. |
Chris@2 | 9 */ |
Chris@2 | 10 |
Chris@2 | 11 namespace PharIo\Manifest; |
Chris@2 | 12 |
Chris@2 | 13 class AuthorCollectionIterator implements \Iterator { |
Chris@2 | 14 /** |
Chris@2 | 15 * @var Author[] |
Chris@2 | 16 */ |
Chris@2 | 17 private $authors = []; |
Chris@2 | 18 |
Chris@2 | 19 /** |
Chris@2 | 20 * @var int |
Chris@2 | 21 */ |
Chris@2 | 22 private $position; |
Chris@2 | 23 |
Chris@2 | 24 public function __construct(AuthorCollection $authors) { |
Chris@2 | 25 $this->authors = $authors->getAuthors(); |
Chris@2 | 26 } |
Chris@2 | 27 |
Chris@2 | 28 public function rewind() { |
Chris@2 | 29 $this->position = 0; |
Chris@2 | 30 } |
Chris@2 | 31 |
Chris@2 | 32 /** |
Chris@2 | 33 * @return bool |
Chris@2 | 34 */ |
Chris@2 | 35 public function valid() { |
Chris@2 | 36 return $this->position < count($this->authors); |
Chris@2 | 37 } |
Chris@2 | 38 |
Chris@2 | 39 /** |
Chris@2 | 40 * @return int |
Chris@2 | 41 */ |
Chris@2 | 42 public function key() { |
Chris@2 | 43 return $this->position; |
Chris@2 | 44 } |
Chris@2 | 45 |
Chris@2 | 46 /** |
Chris@2 | 47 * @return Author |
Chris@2 | 48 */ |
Chris@2 | 49 public function current() { |
Chris@2 | 50 return $this->authors[$this->position]; |
Chris@2 | 51 } |
Chris@2 | 52 |
Chris@2 | 53 public function next() { |
Chris@2 | 54 $this->position++; |
Chris@2 | 55 } |
Chris@2 | 56 } |