| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 88.24% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | final class UserRepository extends Select\Repository implements IdentityWithTokenRepositoryInterface, IdentityRepositoryInterface |
||
| 15 | { |
||
| 16 | private ORMInterface $orm; |
||
| 17 | |||
| 18 | 12 | public function __construct(Select $select, ORMInterface $orm) |
|
| 19 | { |
||
| 20 | 12 | $this->orm = $orm; |
|
| 21 | 12 | parent::__construct($select); |
|
| 22 | 12 | } |
|
| 23 | |||
| 24 | public function findIdentity(string $id): ?IdentityInterface |
||
| 25 | { |
||
| 26 | return $this->findIdentityBy('id', $id); |
||
| 27 | } |
||
| 28 | |||
| 29 | 5 | public function findIdentityByToken(string $token, string $type = null): ?IdentityInterface |
|
| 30 | { |
||
| 31 | 5 | return $this->findIdentityBy('token', $token); |
|
| 32 | } |
||
| 33 | |||
| 34 | 1 | public function findByLogin(string $login): ?IdentityInterface |
|
| 35 | { |
||
| 36 | 1 | return $this->findIdentityBy('login', $login); |
|
| 37 | } |
||
| 38 | |||
| 39 | 2 | public function save(IdentityInterface $user): void |
|
| 44 | 2 | } |
|
| 45 | |||
| 46 | 6 | private function findIdentityBy(string $field, string $value): ?IdentityInterface |
|
| 52 | } |
||
| 53 | } |
||
| 54 |