Completed
Push — master ( 660252...6055b4 )
by ARCANEDEV
13:08 queued 05:17
created

EventServiceProvider   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 62
ccs 0
cts 18
cp 0
rs 10
c 1
b 0
f 0
wmc 6
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A listens() 0 4 1
A boot() 0 12 4
A register() 0 4 1
1
<?php namespace Arcanedev\Support\Providers;
2
3
use Illuminate\Support\Facades\Event;
4
use Illuminate\Support\ServiceProvider;
5
6
/**
7
 * Class     EventServiceProvider
8
 *
9
 * @package  Arcanedev\Support\Laravel\Providers
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
abstract class EventServiceProvider extends ServiceProvider
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Properties
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    /**
19
     * The event handler mappings for the application.
20
     *
21
     * @var array
22
     */
23
    protected $listen = [];
24
25
    /**
26
     * The subscriber classes to register.
27
     *
28
     * @var array
29
     */
30
    protected $subscribe = [];
31
32
    /* ------------------------------------------------------------------------------------------------
33
     |  Getters & Setters
34
     | ------------------------------------------------------------------------------------------------
35
     */
36
    /**
37
     * Get the events and handlers.
38
     *
39
     * @return array
40
     */
41
    public function listens()
42
    {
43
        return $this->listen;
44
    }
45
46
    /* ------------------------------------------------------------------------------------------------
47
     |  Main Functions
48
     | ------------------------------------------------------------------------------------------------
49
     */
50
    /**
51
     * Register the application's event listeners.
52
     */
53
    public function boot()
54
    {
55
        foreach ($this->listens() as $event => $listeners) {
56
            foreach ($listeners as $listener) {
57
                Event::listen($event, $listener);
58
            }
59
        }
60
61
        foreach ($this->subscribe as $subscriber) {
62
            Event::subscribe($subscriber);
63
        }
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function register()
70
    {
71
        //
72
    }
73
}
74