CompositeEventDispatcher   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A dispatchEvent() 0 6 2
1
<?php
2
/******************************************************************************
3
 * Copyright (c) 2016 Constantin Galbenu <[email protected]>             *
4
 ******************************************************************************/
5
6
namespace Gica\Cqrs\Event\EventDispatcher;
7
8
9
use Gica\Cqrs\Event\EventDispatcher;
10
use Gica\Cqrs\Event\EventWithMetaData;
11
12
class CompositeEventDispatcher implements EventDispatcher
13
{
14
    /**
15
     * @var EventDispatcher[]
16
     */
17
    private $eventDispatchers;
18
19 1
    public function __construct(
20
        EventDispatcher ...$eventDispatchers
21
    )
22
    {
23 1
        $this->eventDispatchers = $eventDispatchers;
24 1
    }
25
26 1
    public function dispatchEvent(EventWithMetaData $eventWithMetadata)
27
    {
28 1
        foreach ($this->eventDispatchers as $eventDispatcher) {
29 1
            $eventDispatcher->dispatchEvent($eventWithMetadata);
30
        }
31
    }
32
}