Passed
Push — develop ( 97f65e...d0561f )
by Enea
03:00
created

EventServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 21
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUnauthorizedOwnerListeners() 0 9 2
A listens() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Created on 10/03/18 by enea dhack.
7
 */
8
9
namespace Enea\Authorization;
10
11
use Enea\Authorization\Events\UnauthorizedOwner;
12
use Enea\Authorization\Listeners\WriteUnauthorizedLog;
13
use Enea\Authorization\Support\Determiner;
14
use Illuminate\Foundation\Support\Providers\EventServiceProvider as BaseEventServiceProvider;
15
16
class EventServiceProvider extends BaseEventServiceProvider
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function listens()
22
    {
23
        return [
24
            UnauthorizedOwner::class => $this->getUnauthorizedOwnerListeners(),
25
        ];
26
    }
27
28
    private function getUnauthorizedOwnerListeners(): array
29
    {
30
        $listeners = array();
31
32
        if (Determiner::listenUnauthorizedOwnerEventForLogger()) {
33
            $listeners[] = WriteUnauthorizedLog::class;
34
        }
35
36
        return $listeners;
37
    }
38
}
39