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

Channel   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getName() 0 4 1
A getDriver() 0 4 1
A getParameters() 0 4 1
A getParameter() 0 4 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