Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | 2 | public function __invoke(?DateTimeImmutable $expiresAt = null): string |
|
23 | { |
||
24 | 2 | $now = $this->roundDateToCurrentSecond(Chronos::now()); |
|
25 | 2 | $expiresAt = $expiresAt === null ? $now->addMinutes(10) : $this->roundDateToCurrentSecond($expiresAt); |
|
26 | |||
27 | 2 | return (string) $this->jwtConfig |
|
28 | 2 | ->createBuilder() |
|
29 | 2 | ->issuedBy($this->mercureConfig['jwt_issuer'] ?? 'Shlink') |
|
30 | 2 | ->issuedAt($now) |
|
31 | 2 | ->expiresAt($expiresAt) |
|
32 | 2 | ->getToken($this->jwtConfig->getSigner(), $this->jwtConfig->getSigningKey()); |
|
33 | } |
||
41 |