Passed
Push — master ( 350d73...c9415f )
by Vladimir
02:02
created

Driver::createResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Channels;
6
7
use Illuminate\Support\Str;
8
use FondBot\Contracts\Event;
9
use Illuminate\Http\Request;
10
use Illuminate\Support\Collection;
11
use FondBot\Drivers\TemplateCompiler;
12
use FondBot\Contracts\Channels\Driver as DriverContract;
13
14
abstract class Driver implements DriverContract
15
{
16
    protected $client;
17
    protected $templateCompiler;
18
19
    public function __construct(TemplateCompiler $templateCompiler = null)
20 1
    {
21
        $this->templateCompiler = $templateCompiler;
22 1
    }
23
24
    /**
25
     * Get driver short name.
26
     *
27
     * This name is used as an alias for configuration.
28
     *
29
     * @return string
30
     */
31
    public function getShortName(): string
32 2
    {
33
        return class_basename($this);
34
    }
35 2
36 2
    /**
37
     * Initialize driver.
38 2
     *
39
     * @param Collection $parameters
40
     *
41
     * @return Driver|DriverContract|static
42
     */
43
    public function initialize(Collection $parameters): DriverContract
44
    {
45
        $parameters->each(function ($value, $key) {
46
            $key = Str::camel($key);
47
            $this->$key = $value;
48
        });
49
50
        $this->client = $this->createClient();
51
52
        return $this;
53
    }
54
55
    /**
56
     * Get API client.
57
     *
58
     * @return mixed
59
     */
60
    public function getClient()
61
    {
62
        return $this->client;
63
    }
64
65
    /**
66
     * Create HTTP response.
67
     *
68
     * @param Request $request
69
     * @param Event $event
70
     *
71
     * @return mixed
72
     */
73
    public function createResponse(Request $request, Event $event)
74
    {
75
        return [];
76
    }
77
}
78