EventRegistry::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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