Total Complexity | 5 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class UserRepository extends Select\Repository implements IdentityRepositoryInterface |
||
12 | { |
||
13 | public function __construct(ORMInterface $orm, $role = User::class) |
||
14 | { |
||
15 | parent::__construct(new Select($orm, $role)); |
||
16 | } |
||
17 | |||
18 | private function findIdentityBy(string $field, string $value): ?IdentityInterface |
||
19 | { |
||
20 | return $this->findOne([$field => $value]); |
||
21 | } |
||
22 | |||
23 | public function findIdentity(string $id): ?IdentityInterface |
||
24 | { |
||
25 | return $this->findByPK($id); |
||
26 | } |
||
27 | |||
28 | public function findIdentityByToken(string $token, string $type): ?IdentityInterface |
||
29 | { |
||
30 | return $this->findIdentityBy('token', $token); |
||
31 | } |
||
32 | |||
33 | public function findByLogin(string $login): ?IdentityInterface |
||
36 | } |
||
37 | } |
||
38 |