| Total Complexity | 5 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 15 | abstract class DBALObjectRepository implements Repository |
||
| 16 | { |
||
| 17 | 2 | public function getIterator(): \Traversable |
|
| 18 | { |
||
| 19 | 2 | return static::createResult($this->qb()); |
|
| 20 | } |
||
| 21 | |||
| 22 | 1 | public function count(): int |
|
| 25 | } |
||
| 26 | |||
| 27 | abstract protected static function createObject(array $data): object; |
||
| 28 | |||
| 29 | abstract protected static function tableName(): string; |
||
| 30 | |||
| 31 | abstract protected function connection(): Connection; |
||
| 32 | |||
| 33 | 2 | final protected static function createResult(QueryBuilder $qb): Result |
|
| 34 | { |
||
| 35 | 2 | return new FactoryResult( |
|
| 36 | static function(array $data) { |
||
| 37 | 2 | return static::createObject($data); |
|
| 38 | 2 | }, |
|
| 39 | 2 | static::createDBALQueryBuilderResult($qb) |
|
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | 2 | protected static function createDBALQueryBuilderResult(QueryBuilder $qb): DBALQueryBuilderResult |
|
| 44 | { |
||
| 45 | 2 | return new DBALQueryBuilderResult($qb); |
|
| 46 | } |
||
| 47 | |||
| 48 | 2 | protected function qb(): QueryBuilder |
|
| 51 | } |
||
| 52 | } |
||
| 53 |