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

ChannelManager::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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