Completed
Push — master ( 5bf22f...cf1632 )
by Kirill
06:39
created

AbstractClient::setOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of GitterApi package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
namespace Gitter\Adapters;
9
10
use Gitter\Client;
11
12
/**
13
 * Class AbstractClient
14
 * @package Gitter\Adapters
15
 */
16
abstract class AbstractClient implements AdapterInterface
17
{
18
    /**
19
     * @var array
20
     */
21
    protected $options = [];
22
23
    /**
24
     * @param Client $client
25
     * @return array
26
     */
27
    protected function buildHeaders(Client $client): array
28
    {
29
        return [
30
            'Accept'        => 'application/json',
31
            'Content-Type'  => 'application/json',
32
            'Authorization' => sprintf('Bearer %s', $client->token())
33
        ];
34
    }
35
36
    /**
37
     * @param array $options
38
     * @return AdapterInterface
39
     */
40
    public function setOptions(array $options = []): AdapterInterface
41
    {
42
        $this->options = $options;
43
44
        return $this;
45
    }
46
}
47