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