Completed
Push — master ( afce1d...f8221d )
by Vladimir
09:37
created

Channel   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 84.62%

Importance

Changes 0
Metric Value
dl 0
loc 56
ccs 11
cts 13
cp 0.8462
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getName() 0 4 1
A getParameters() 0 4 1
A getDriver() 0 4 1
A getParameter() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Channels;
6
7
class Channel
8
{
9
    private $name;
10
    private $driver;
11
    private $parameters;
12
13 1
    public function __construct(string $name, string $driver, array $parameters)
14
    {
15 1
        $this->name = $name;
16 1
        $this->driver = $driver;
17 1
        $this->parameters = $parameters;
18 1
    }
19
20
    /**
21
     * Name of the channel.
22
     *
23
     * @return string
24
     */
25 1
    public function getName(): string
26
    {
27 1
        return $this->name;
28
    }
29
30
    /**
31
     * Get driver name.
32
     *
33
     * @return string
34
     */
35
    public function getDriver(): string
36
    {
37
        return $this->driver;
38
    }
39
40
    /**
41
     * Channel parameters.
42
     *
43
     * @return array
44
     */
45 1
    public function getParameters(): array
46
    {
47 1
        return $this->parameters;
48
    }
49
50
    /**
51
     * Get single parameter value.
52
     *
53
     * @param string $name
54
     * @param null   $default
55
     *
56
     * @return mixed
57
     */
58 1
    public function getParameter(string $name, $default = null)
59
    {
60 1
        return array_get($this->parameters, $name, $default);
61
    }
62
}
63