AbstractHydrator.php
9 months ago
ArrayHydrator.php
9 months ago
HydrationException.php
9 months ago
IterableResult.php
9 months ago
ObjectHydrator.php
9 months ago
ScalarColumnHydrator.php
9 months ago
ScalarHydrator.php
9 months ago
SimpleObjectHydrator.php
9 months ago
SingleScalarHydrator.php
9 months ago
index.php
9 months ago
IterableResult.php
49 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM\Internal\Hydration; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use Iterator; |
| 6 | use ReturnTypeWillChange; |
| 7 | class IterableResult implements Iterator |
| 8 | { |
| 9 | private $hydrator; |
| 10 | private $rewinded = \false; |
| 11 | private $key = -1; |
| 12 | private $current = null; |
| 13 | public function __construct($hydrator) |
| 14 | { |
| 15 | $this->hydrator = $hydrator; |
| 16 | } |
| 17 | #[\ReturnTypeWillChange] |
| 18 | public function rewind() |
| 19 | { |
| 20 | if ($this->rewinded === \true) { |
| 21 | throw new HydrationException('Can only iterate a Result once.'); |
| 22 | } |
| 23 | $this->current = $this->next(); |
| 24 | $this->rewinded = \true; |
| 25 | } |
| 26 | #[\ReturnTypeWillChange] |
| 27 | public function next() |
| 28 | { |
| 29 | $this->current = $this->hydrator->hydrateRow(); |
| 30 | $this->key++; |
| 31 | return $this->current; |
| 32 | } |
| 33 | #[\ReturnTypeWillChange] |
| 34 | public function current() |
| 35 | { |
| 36 | return $this->current; |
| 37 | } |
| 38 | #[\ReturnTypeWillChange] |
| 39 | public function key() |
| 40 | { |
| 41 | return $this->key; |
| 42 | } |
| 43 | #[\ReturnTypeWillChange] |
| 44 | public function valid() |
| 45 | { |
| 46 | return $this->current !== \false; |
| 47 | } |
| 48 | } |
| 49 |