Completed
Push — develop ( 20a922...5bb600 )
by Enea
05:08 queued 03:13
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
declare(strict_types=1);
4
5
/**
6
 * Created on 11/02/18 by enea dhack.
7
 */
8
9
namespace Enea\Authorization\Traits;
10
11
use Enea\Authorization\Contracts\PermissionContract;
12
13
trait HasPermission
14
{
15
    use Grantable;
16
17 1
    public static function locateByName(string $secretName): ?PermissionContract
18
    {
19 1
        $permission = static::query()->where('secret_name', $secretName)->first();
20 1
        return $permission instanceof PermissionContract ? $permission : null;
21
    }
22
}
23