Total Complexity | 4 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | class Auth implements AuthInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $token; |
||
19 | |||
20 | /** |
||
21 | * AuthInterface constructor. |
||
22 | * |
||
23 | * @param string $token |
||
24 | */ |
||
25 | 2 | public function __construct(string $token) |
|
28 | 2 | } |
|
29 | |||
30 | /** |
||
31 | * Prepare the headers for successive implementations |
||
32 | * |
||
33 | * @return array |
||
34 | */ |
||
35 | 1 | public function getHeaders(): array |
|
36 | { |
||
37 | $headers = [ |
||
38 | 1 | 'Authorization: Bearer '.$this->getToken(), |
|
39 | 1 | 'Accept' => 'application/json', |
|
40 | 1 | 'Content-Type' => 'application/json' |
|
41 | ]; |
||
42 | 1 | return $headers; |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param $token |
||
47 | */ |
||
48 | 2 | private function setToken($token) |
|
49 | { |
||
50 | 2 | $this->token = $token; |
|
51 | 2 | } |
|
52 | |||
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | 1 | private function getToken() |
|
60 | } |
||
61 | } |
||
62 |