Operator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 3
b 0
f 0
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A dispatchEvent() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Created on 13/02/18 by enea dhack.
7
 */
8
9
namespace Enea\Authorization\Operators;
10
11
use Enea\Authorization\Contracts\{
12
    PermissionsOwner, RolesOwner
13
};
14
use Enea\Authorization\Events\Operation;
15
use Illuminate\Contracts\Events\Dispatcher;
16
use Illuminate\Support\Collection;
17
18
abstract class Operator
19
{
20
    private $event;
21
22 58
    public function __construct(Dispatcher $event)
23
    {
24 58
        $this->event = $event;
25 58
    }
26
27
    abstract public function permissions(PermissionsOwner $owner, Collection $permissions): void;
28
29
    abstract public function roles(RolesOwner $owner, Collection $roles): void;
30
31 54
    protected function dispatchEvent(Operation $operation): void
32
    {
33 54
        $this->event->dispatch($operation);
34 54
    }
35
}
36