Passed
Branch 1.0 (f7255b)
by Vladimir
06:00
created

Channel::getParameter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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