Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 2 |
1 | <?php |
||
56 | 4 | public function getToken(array $claims = []) |
|
57 | { |
||
58 | 4 | $issuer = (string) $this->request->getUri(); |
|
59 | 4 | $issued_at = $this->config->getTimestamp(); |
|
60 | 4 | $expiration = $issued_at + $this->config->getTtl(); |
|
61 | 4 | $key = $this->config->getPrivateKey(); |
|
62 | 4 | foreach ($claims as $name => $value) { |
|
63 | 4 | $this->builder->set($name, $value); |
|
64 | 4 | } |
|
65 | 4 | $token = $this->builder |
|
66 | 4 | ->setIssuer($issuer) |
|
67 | 4 | ->setIssuedAt($issued_at) |
|
68 | 4 | ->setExpiration($expiration) |
|
69 | 4 | ->sign($this->signer, $key) |
|
70 | 4 | ->getToken(); |
|
71 | 4 | return (string) $token; |
|
72 | } |
||
73 | } |
||
74 |