Completed
Push — master ( 2f4806...4e3d73 )
by Renato
05:45
created

EventCleanCacheRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 44
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 3
A register() 0 4 1
1
<?php
2
namespace NwLaravel\ServiceProvider;
3
4
use Illuminate\Support\ServiceProvider;
5
6
class EventCleanCacheRepository extends ServiceProvider
7
{
8
9
    /**
10
     * The event handler mappings for the application.
11
     *
12
     * @var array
13
     */
14
    protected $listen = [
15
        'Prettus\Repository\Events\RepositoryEntityCreated' => [
16
            'NwLaravel\Repositories\Listeners\CleanCacheRepository'
17
        ],
18
        'Prettus\Repository\Events\RepositoryEntityUpdated' => [
19
            'NwLaravel\Repositories\Listeners\CleanCacheRepository'
20
        ],
21
        'Prettus\Repository\Events\RepositoryEntityDeleted' => [
22
            'NwLaravel\Repositories\Listeners\CleanCacheRepository'
23
        ]
24
    ];
25
26
    /**
27
     * Register the application's event listeners.
28
     *
29
     * @return void
30
     */
31
    public function boot()
32
    {
33
        $events = app('events');
34
35
        foreach ($this->listen as $event => $listeners) {
36
            foreach ($listeners as $listener) {
37
                $events->listen($event, $listener);
38
            }
39
        }
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function register()
46
    {
47
        //
48
    }
49
}
50