Completed
Push — develop ( e65f1e...f99f9b )
by Enea
02:04
created

Operator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

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 34
    public function __construct(Dispatcher $event)
23
    {
24 34
        $this->event = $event;
25 34
    }
26
27
    abstract public function permissions(PermissionsOwner $owner, Collection $permissions): void;
28
29
    abstract public function roles(RolesOwner $owner, Collection $roles): void;
30
31 30
    protected function dispatchEvent(Operation $operation): void
32
    {
33 30
        $this->event->dispatch($operation);
34 30
    }
35
}
36