Passed
Pull Request — develop (#10)
by Alessandro
01:18
created

Adapter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 38
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setToken() 0 3 1
A getToken() 0 3 1
A getHeaders() 0 8 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: aless
5
 * Date: 13/03/2019
6
 * Time: 12:39
7
 */
8
9
namespace Bitlywrap\Adapter;
10
11
use Bitlywrap\Interfaces\AdapterInterface;
12
13
class Adapter implements AdapterInterface
14
{
15
    /**
16
     * @var string
17
     */
18
    private $token;
19
20
    /**
21
     * Prepare the headers for successive implementations
22
     *
23
     * @return array
24
     */
25 1
    public function getHeaders(): array
26
    {
27
        $headers = [
28 1
            'Authorization: Bearer '.$this->getToken(),
29 1
            'Accept'        => 'application/json',
30 1
            'Content-Type'  => 'application/json'
31
        ];
32 1
        return $headers;
33
    }
34
35
    /**
36
     * Set the token
37
     *
38
     * @param string
39
     */
40 1
    public function setToken(string $token)
41
    {
42 1
        $this->token = $token;
43 1
    }
44
45
    /**
46
     * @return string
47
     */
48 1
    private function getToken()
49
    {
50 1
        return $this->token;
51
    }
52
}
53