| Total Complexity | 6 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | class Repository implements RepositoryInterface |
||
| 19 | { |
||
| 20 | /** @var Select */ |
||
| 21 | protected $selector; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Create repository linked to one specific selector. |
||
| 25 | * |
||
| 26 | * @param Select $selector |
||
| 27 | */ |
||
| 28 | public function __construct(Select $selector) |
||
| 29 | { |
||
| 30 | $this->selector = $selector; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @inheritdoc |
||
| 35 | */ |
||
| 36 | public function findByPK($id) |
||
| 37 | { |
||
| 38 | return $this->select()->wherePK($id)->fetchOne(); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @inheritdoc |
||
| 43 | */ |
||
| 44 | public function findOne(array $scope = []) |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @inheritdoc |
||
| 51 | */ |
||
| 52 | public function findAll(array $scope = [], array $orderBy = []): iterable |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Get selector associated with the repository. |
||
| 59 | * |
||
| 60 | * @return Select|iterable |
||
| 61 | */ |
||
| 62 | public function select(): Select |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Repositories are always immutable by default. |
||
| 69 | */ |
||
| 70 | public function __clone() |
||
| 73 | } |
||
| 74 | } |