| Total Complexity | 7 |
| Total Lines | 72 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | final class Iterator implements \IteratorAggregate |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var ORMInterface |
||
| 23 | */ |
||
| 24 | private $orm; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var string |
||
| 28 | */ |
||
| 29 | private $role; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var iterable |
||
| 33 | */ |
||
| 34 | private $source; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @var bool |
||
| 38 | */ |
||
| 39 | private $tryToFindInHeap; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param ORMInterface $orm |
||
| 43 | * @param string $class |
||
| 44 | * @param iterable $source |
||
| 45 | * @param bool $tryToFindInHeap |
||
| 46 | */ |
||
| 47 | public function __construct(ORMInterface $orm, string $class, iterable $source, bool $tryToFindInHeap = false) |
||
| 48 | { |
||
| 49 | $this->orm = $orm; |
||
| 50 | $this->role = $this->orm->resolveRole($class); |
||
| 51 | $this->source = $source; |
||
| 52 | $this->tryToFindInHeap = $tryToFindInHeap; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Generate entities using incoming data stream. Pivoted data would be |
||
| 57 | * returned as key value if set. |
||
| 58 | * |
||
| 59 | * @return \Generator |
||
| 60 | */ |
||
| 61 | public function getIterator(): \Generator |
||
| 74 | } |
||
| 75 | } |
||
| 76 | |||
| 77 | private function getEntity(array $data) |
||
| 91 | } |
||
| 92 | } |
||
| 93 |