Client   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 35
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultOptions() 0 13 1
A renderAuthorization() 0 15 3
1
<?php
2
3
/*
4
 * This file is part of gpupo/netshoes-sdk
5
 * Created by Gilmar Pupo <[email protected]>
6
 * For the information of copyright and license you should read the file
7
 * LICENSE which is distributed with this source code.
8
 * Para a informação dos direitos autorais e de licença você deve ler o arquivo
9
 * LICENSE que é distribuído com este código-fonte.
10
 * Para obtener la información de los derechos de autor y la licencia debe leer
11
 * el archivo LICENSE que se distribuye con el código fuente.
12
 * For more information, see <https://www.gpupo.com/>.
13
 */
14
15
namespace Gpupo\NetshoesSdk\Client;
16
17
use Gpupo\CommonSdk\Client\ClientAbstract;
18
use Gpupo\CommonSdk\Client\ClientInterface;
19
20
final class Client extends ClientAbstract implements ClientInterface
21
{
22
    /**
23
     * @codeCoverageIgnore
24
     */
25
    public function getDefaultOptions()
26
    {
27
        return [
28
            'client_id'     => false,
29
            'access_token'  => false,
30
            'base_url'      => 'http://api-{VERSION}.netshoes.com.br/api/v1',
31
            'version'       => 'sandbox',
32
            'verbose'       => true,
33
            'sslVersion'    => 'SecureTransport',
34
            'cacheTTL'      => 3600,
35
            'sslVerifyPeer' => true,
36
        ];
37
    }
38
39 2
    protected function renderAuthorization()
40
    {
41 2
        $list = [];
42
43 2
        foreach (['client_id', 'access_token'] as $key) {
44 2
            $value = $this->getOptions()->get($key);
45 2
            if (empty($value)) {
46 1
                throw new \InvalidArgumentException('['.$key.'] ausente!');
47
            }
48
49 1
            $list[] = $key.':'.$value;
50
        }
51
52 1
        return $list;
53
    }
54
}
55