Total Complexity | 5 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 75% |
Changes | 0 |
1 | <?php |
||
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() |
||
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) |
||
76 | } |
||
77 | } |
||
78 |