| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2.0932 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 4 | public function __invoke(RequestInterface $request): RequestInterface |
|
| 25 | { |
||
| 26 | 4 | $token = $this->cacheHandler->getTokenByProvider($this->provider, $this->config); |
|
| 27 | 4 | if (false === $token) { |
|
| 28 | 2 | $accessToken = $this->getAccessToken(); |
|
| 29 | $token = $accessToken->getToken(); |
||
| 30 | $this->cacheHandler->saveTokenByProvider($accessToken, $this->provider, $this->config); |
||
| 31 | } |
||
| 32 | |||
| 33 | 2 | return $request->withHeader('Authorization', 'Bearer ' . $token); |
|
| 34 | } |
||
| 35 | |||
| 50 |