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

Operator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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