AbstractAdapter::response()   A
last analyzed

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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Kerox\Push\Adapter;
4
5
use Cake\Core\InstanceConfigTrait;
6
use Kerox\Push\AdapterInterface;
7
8
abstract class AbstractAdapter implements AdapterInterface
9
{
10
    use InstanceConfigTrait;
0 ignored issues
show
Bug introduced by
The trait Cake\Core\InstanceConfigTrait requires the property $_defaultConfig which is not provided by Kerox\Push\Adapter\AbstractAdapter.
Loading history...
11
12
    /**
13
     * Response of the request
14
     *
15
     * @var \Psr\Http\Message\ResponseInterface
16
     */
17
    protected $response;
18
19
    /**
20
     * AbstractAdapter constructor.
21
     *
22
     * @param string|array $config The Adapter configuration
23
     *
24
     * @throws \Exception
25
     */
26 15
    public function __construct($config)
27
    {
28 15
        $this->setConfig($config);
29
30 15
        if ($this->getConfig('api.key') === null) {
31 1
            throw new \InvalidArgumentException('No API key set.');
32
        }
33 15
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    abstract public function send();
39
40
    /**
41
     * @inheritdoc
42
     */
43 2
    public function response()
44
    {
45 2
        return $this->response;
46
    }
47
}
48