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

ChannelManager::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

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