Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
14 | class ApiToken implements AuthorizationInterface |
||
15 | { |
||
16 | /** |
||
17 | * @static string |
||
18 | */ |
||
19 | const DEFAULT_API_KEY = 'X-API-Key'; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $key = self::DEFAULT_API_KEY; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $token; |
||
30 | |||
31 | /** |
||
32 | * ApiToken constructor. |
||
33 | * |
||
34 | * @param string $key |
||
35 | * @param string $token |
||
36 | */ |
||
37 | 5 | public function __construct(string $token, string $key = self::DEFAULT_API_KEY) |
|
41 | 5 | } |
|
42 | |||
43 | /** |
||
44 | * Get a request with the headers associated with the authorization. |
||
45 | * |
||
46 | * @param RequestInterface $request |
||
47 | * @return RequestInterface |
||
48 | */ |
||
49 | 5 | public function handle(RequestInterface $request): RequestInterface |
|
57 |