FindPermissionAction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 2
1
<?php
2
3
namespace App\Containers\Authorization\Actions;
4
5
use Apiato\Core\Foundation\Facades\Apiato;
6
use App\Containers\Authorization\Exceptions\PermissionNotFoundException;
7
use App\Containers\Authorization\Models\Permission;
8
use App\Ship\Parents\Actions\Action;
9
use App\Ship\Transporters\DataTransporter;
10
11
/**
12
 * Class FindPermissionAction.
13
 *
14
 * @author Mahmoud Zalt <[email protected]>
15
 */
16
class FindPermissionAction extends Action
17
{
18
19
    /**
20
     * @param \App\Ship\Transporters\DataTransporter $data
21
     *
22
     * @return  \App\Containers\Authorization\Models\Permission
23
     * @throws  PermissionNotFoundException
24
     */
25
    public function run(DataTransporter $data): Permission
26
    {
27
        $permission = Apiato::call('[email protected]', [$data->id]);
28
29
        if (!$permission) {
30
            throw new PermissionNotFoundException();
31
        }
32
33
        return $permission;
34
    }
35
36
}
37