1 | <?php |
||
2 | |||
3 | namespace Ignis\Service; |
||
4 | |||
5 | use Ignis\Entity; |
||
6 | use Ignis\Mapper; |
||
7 | use Memcached; |
||
8 | |||
9 | class Authentication |
||
10 | { |
||
11 | private $storage; |
||
12 | private $lifetime; |
||
13 | private $burndown; |
||
14 | |||
15 | public function __construct(Memcached $storage, int $lifetime, int $burndown) |
||
16 | { |
||
17 | $this->storage = $storage; |
||
18 | $this->lifetime = $lifetime; |
||
19 | $this->burndown = $burndown; |
||
20 | } |
||
21 | |||
22 | public function createIdentity(int $accountId, string $payload): Entity\Identity |
||
23 | { |
||
24 | $identity = new Entity\Identity; |
||
25 | $identity->genrateToken(); |
||
26 | |||
27 | $identity->setAccountId($accountId); |
||
28 | $identity->setPayload($payload); |
||
29 | |||
30 | $mapper = new Mapper\Identity($this->storage, $this->lifetime, $this->burndown); |
||
0 ignored issues
–
show
|
|||
31 | $mapper->store($identity); |
||
32 | |||
33 | return $identity; |
||
34 | } |
||
35 | |||
36 | public function retrieveIdentity(string $token): Entity\Identity |
||
37 | { |
||
38 | $identity = new Entity\Identity; |
||
39 | $identity->setToken($token); |
||
40 | |||
41 | try { |
||
42 | $mapper = new Mapper\Identity($this->storage, $this->lifetime, $this->burndown); |
||
43 | $mapper->fetch($identity); |
||
44 | } catch (Exception\EntityNotFound $exception) { |
||
0 ignored issues
–
show
The type
Ignis\Service\Exception\EntityNotFound was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
45 | throw new Exception\IdentityNotFound; |
||
0 ignored issues
–
show
The type
Ignis\Service\Exception\IdentityNotFound was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
46 | } |
||
47 | |||
48 | if (null === $identity->getActivationTime()) { |
||
49 | $identity->setActivationTime(new DateTimeImmutable); |
||
0 ignored issues
–
show
|
|||
50 | $mapper->store($identity); |
||
51 | } |
||
52 | |||
53 | return $identity; |
||
54 | } |
||
55 | } |
||
56 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths