Completed
Push — master ( 959e53...d74161 )
by Vladimir
12:00
created

Driver   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
dl 0
loc 40
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getShortName() 0 4 1
A initialize() 0 8 1
A getTemplateRenderer() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Channels;
6
7
use Illuminate\Support\Collection;
8
use FondBot\Drivers\TemplateRenderer;
9
use FondBot\Contracts\Channels\Driver as DriverContract;
10
11
abstract class Driver implements DriverContract
12
{
13
    /**
14
     * Get driver short name.
15
     *
16
     * This name is used as an alias for configuration.
17
     *
18
     * @return string
19
     */
20 1
    public function getShortName(): string
21
    {
22 1
        return class_basename($this);
23
    }
24
25
    /**
26
     * Initialize driver.
27
     *
28
     * @param Collection $parameters
29
     *
30
     * @return Driver|DriverContract|static
31
     */
32 2
    public function initialize(Collection $parameters): DriverContract
33
    {
34
        $parameters->each(function ($value, $key) {
35 2
            $this->$key = $value;
36 2
        });
37
38 2
        return $this;
39
    }
40
41
    /**
42
     * Get template compiler instance.
43
     *
44
     * @return TemplateRenderer|null
45
     */
46
    public function getTemplateRenderer(): ?TemplateRenderer
47
    {
48
        return null;
49
    }
50
}
51