EventServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
c 1
b 1
f 0
lcom 1
cbo 2
dl 0
loc 27
ccs 0
cts 13
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 10 1
A boot() 0 3 1
1
<?php
2
namespace Wandu\Event;
3
4
use Wandu\DI\ContainerInterface;
5
use Wandu\DI\ServiceProviderInterface;
6
use Wandu\Event\Contracts\EventEmitter as EventEmitterContract;
7
use Wandu\Q\Worker;
8
9
class EventServiceProvider implements ServiceProviderInterface
10
{
11
    /** @var array */
12
    protected $listeners = [
13
    ];
14
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function register(ContainerInterface $app)
19
    {
20
        $app->closure(EventEmitter::class, function (ContainerInterface $container, Worker $worker) {
21
            $emitter = new EventEmitter($this->listeners);
22
            $emitter->setContainer($container);
23
            $emitter->setWorker($worker);
24
            return $emitter;
25
        });
26
        $app->alias(EventEmitterContract::class, EventEmitter::class);
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function boot(ContainerInterface $app)
33
    {
34
    }
35
}
36