| Total Complexity | 2 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | final class HttpBearer extends HttpHeader |
||
| 15 | { |
||
| 16 | protected string $headerName = 'Authorization'; |
||
| 17 | protected string $pattern = '/^Bearer\s+(.*?)$/'; |
||
| 18 | private string $realm = 'api'; |
||
| 19 | |||
| 20 | 3 | public function challenge(ResponseInterface $response): ResponseInterface |
|
| 21 | { |
||
| 22 | 3 | return $response->withHeader('WWW-Authenticate', "{$this->headerName} realm=\"{$this->realm}\""); |
|
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $realm The HTTP authentication realm. |
||
| 27 | * @return self |
||
| 28 | */ |
||
| 29 | 1 | public function withRealm(string $realm): self |
|
| 34 | } |
||
| 35 | } |
||
| 36 |