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
![]() |
|||
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 |