| Total Complexity | 13 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | final class SqlQueryResult implements \IteratorAggregate, \Countable |
||
| 17 | { |
||
| 18 | private $data; |
||
| 19 | private $metadata; |
||
| 20 | private $keys; |
||
| 21 | |||
| 22 | 28 | public function __construct(array $data, array $metadata) |
|
| 23 | { |
||
| 24 | 28 | $this->data = $data; |
|
| 25 | 28 | $this->metadata = $metadata; |
|
| 26 | |||
| 27 | 28 | unset($this->keys); |
|
| 28 | 28 | } |
|
| 29 | |||
| 30 | 10 | public function getData() : array |
|
| 31 | { |
||
| 32 | 10 | return $this->data; |
|
| 33 | } |
||
| 34 | |||
| 35 | 4 | public function getMetadata() : array |
|
| 36 | { |
||
| 37 | 4 | return $this->metadata; |
|
| 38 | } |
||
| 39 | |||
| 40 | 4 | public function isEmpty() : bool |
|
| 41 | { |
||
| 42 | 4 | return [] === $this->data; |
|
| 43 | } |
||
| 44 | |||
| 45 | 4 | public function getFirst() : ?array |
|
| 48 | } |
||
| 49 | |||
| 50 | 4 | public function getLast() : ?array |
|
| 53 | } |
||
| 54 | |||
| 55 | 2 | public function getIterator() : \Generator |
|
| 56 | { |
||
| 57 | 2 | foreach ($this->data as $item) { |
|
| 58 | 2 | yield \array_combine($this->keys, $item); |
|
| 59 | } |
||
| 60 | 2 | } |
|
| 61 | |||
| 62 | 2 | public function count() : int |
|
| 63 | { |
||
| 64 | 2 | return \count($this->data); |
|
| 65 | } |
||
| 66 | |||
| 67 | 6 | public function __get(string $property) : array |
|
| 70 | } |
||
| 71 | } |
||
| 72 |