DispatcherCollection::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Deployee\Plugins\Deploy\Dispatcher;
4
5
6
class DispatcherCollection
7
{
8
    /**
9
     * @var array
10
     */
11
    private $dispatcher;
12
13
    /**
14
     * DispatcherCollection constructor.
15
     */
16
    public function __construct()
17
    {
18
        $this->dispatcher = [];
19
    }
20
21
    /**
22
     * @param TaskDefinitionDispatcherInterface[] $collection
23
     */
24
    public function addDispatcherArray(array $collection)
25
    {
26
        foreach($collection as $dispatcher){
27
            $this->addDispatcher($dispatcher);
28
        }
29
    }
30
31
    /**
32
     * @param TaskDefinitionDispatcherInterface $dispatcher
33
     */
34
    public function addDispatcher(TaskDefinitionDispatcherInterface $dispatcher)
35
    {
36
        $this->dispatcher[] = $dispatcher;
37
    }
38
39
    /**
40
     * @return TaskDefinitionDispatcherInterface[]
41
     */
42
    public function toArray(): array
43
    {
44
        return $this->dispatcher;
45
    }
46
}