Passed
Branch feature/deny (0fd688)
by Enea
02:29
created

DeleteDeniedPermissions   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author enea dhack <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Enea\Authorization\Operators;
13
14
use Enea\Authorization\Contracts\DeniableOwner;
15
use Illuminate\Support\Collection;
16
17
class DeleteDeniedPermissions
18
{
19
    private $owner;
20
21
    private $permissions;
22
23 25
    public function __construct(DeniableOwner $owner, Collection $permissions)
24
    {
25 25
        $this->owner = $owner;
26 25
        $this->permissions = $permissions;
27 25
    }
28
29 25
    public function make(): void
30
    {
31 25
        $this->owner->denied()->detach($this->permissions->pluck('id'));
32 25
    }
33
}
34