Completed
Push — master ( fd5849...c99aaa )
by Renato
05:53
created

EventCleanCacheRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 44
ccs 10
cts 10
cp 1
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 1
    public function boot()
32
    {
33 1
        $events = app('events');
34
35 1
        foreach ($this->listen as $event => $listeners) {
36 1
            foreach ($listeners as $listener) {
37 1
                $events->listen($event, $listener);
38 1
            }
39 1
        }
40 1
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 1
    public function register()
46
    {
47
        //
48 1
    }
49
}
50