EventRegistry   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A subscribe() 0 8 3
1
<?php namespace Nwidart\LaravelBroadway\Registries;
2
3
use Broadway\EventHandling\EventBus;
4
5
class EventRegistry extends BaseRegistry implements Registry
6
{
7
    /**
8
     * @var EventBus
9
     */
10
    private $eventBus;
11
12
    public function __construct(EventBus $eventBus)
13
    {
14
        $this->eventBus = $eventBus;
15
    }
16
17
    /**
18
     * Subscribe the given array of projectors on the event bus
19
     * @param  array $projectors
20
     */
21
    public function subscribe($projectors)
22
    {
23
        $projectors = $this->isTraversable($projectors) ? $projectors : [$projectors];
24
25
        foreach ($projectors as $projector) {
26
            $this->eventBus->subscribe($projector);
27
        }
28
    }
29
}
30