Completed
Push — master ( f8f3cb...e8d4bf )
by Romain
9s
created

AbstractAdapter::send()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 1
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
11
    use InstanceConfigTrait;
12
13
    /**
14
     * Response of the request
15
     *
16
     * @var \Psr\Http\Message\ResponseInterface
17
     */
18
    protected $response;
19
20
    /**
21
     * AbstractAdapter constructor.
22
     *
23
     * @param string|array $config The Adapter configuration
24
     * @throws \Exception
25
     */
26
    public function __construct($config)
27
    {
28
        $this->setConfig($config);
29
30
        if ($this->getConfig('api.key') === null) {
31
            throw new \Exception("No API key set.");
32
        }
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    abstract public function send();
39
40
    /**
41
     * @inheritdoc
42
     */
43
    public function response()
44
    {
45
        return $this->response;
46
    }
47
}
48