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

Adapter::setToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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