Test Failed
Pull Request — stable (#129)
by
unknown
02:21
created

EventServiceProvider::boot()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 7
nc 6
nop 0
dl 0
loc 13
rs 9.2
c 0
b 0
f 0
1
<?php namespace LaravelZero\Framework\Commands\Component\Illuminate\Events;
2
3
use Illuminate\Support\ServiceProvider;
4
5
class EventServiceProvider extends ServiceProvider
6
{
7
    /**
8
     * The event handler mappings for the application.
9
     *
10
     * @var array
11
     */
12
    protected $listen = [];
13
14
    /**
15
     * The subscriber classes to register.
16
     *
17
     * @var array
18
     */
19
    protected $subscribe = [];
20
21
    /**
22
     * Register the application's event listeners.
23
     *
24
     * @return void
25
     */
26
    public function boot()
27
    {
28
        $dispatcher = $this->app->make('events');
29
        foreach ($this->listens() as $event => $listeners) {
30
            foreach ($listeners as $listener) {
31
                $dispatcher->listen($event, $listener);
32
            }
33
        }
34
35
        foreach ($this->subscribe as $subscriber) {
36
            $dispatcher->subscribe($subscriber);
37
        }
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function register()
44
    {
45
        //
46
    }
47
48
    /**
49
     * Get the events and handlers.
50
     *
51
     * @return array
52
     */
53
    public function listens()
54
    {
55
        return $this->listen;
56
    }
57
}
58