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

Channel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 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