Completed
Push — master ( 570f1a...576848 )
by Nikola
03:44
created

ChannelManager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A get() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Notifier\Channel;
6
7
class ChannelManager
8
{
9
    /** @var Channel[] */
10
    protected $channels;
11
12 1
    public function __construct(Channel ...$channels)
13
    {
14 1
        foreach ($channels as $channel) {
15 1
            $this->channels[$channel->getName()] = $channel;
16
        }
17 1
    }
18
19 1
    public function get(string $channelName): Channel
20
    {
21 1
        return $this->channels[$channelName];
22
    }
23
}
24