GetRoleAction::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace App\Containers\Authorization\Actions;
4
5
use App\Containers\Authorization\Exceptions\RoleNotFoundException;
6
use App\Containers\Authorization\Tasks\GetRoleTask;
7
use App\Ship\Parents\Actions\Action;
8
9
/**
10
 * Class GetRoleAction.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class GetRoleAction extends Action
15
{
16
17
    /**
18
     * @param Integer|String $roleNameOrId
19
     *
20
     * @return  mixed
21
     */
22
    public function run($roleNameOrId)
23
    {
24
        $role = $this->call(GetRoleTask::class, [$roleNameOrId]);
25
26
        if (!$role) {
27
            throw new RoleNotFoundException();
28
        }
29
30
        return $role;
31
    }
32
33
}
34