Completed
Push — develop ( 741023...325480 )
by Enea
02:01
created

HasPermission   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A locateByName() 0 4 2
1
<?php
2
/**
3
 * Created on 11/02/18 by enea dhack.
4
 */
5
6
namespace Enea\Authorization\Traits;
7
8
use Enea\Authorization\Contracts\PermissionContract;
9
10
trait HasPermission
11
{
12
    use Grantable;
13
14 1
    public static function locateByName(string $secretName): ?PermissionContract
15
    {
16 1
        $permission = static::query()->where('secret_name', $secretName)->first();
17 1
        return $permission instanceof PermissionContract ? $permission : null;
18
    }
19
}
20