Passed
Push — develop ( 4dcb6f...41c931 )
by Enea
02:43
created

IsPermission   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A locateByName() 0 4 2
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\Traits;
13
14
use Enea\Authorization\Contracts\PermissionContract;
15
16
trait IsPermission
17
{
18
    use Grantable;
19
20 1
    public static function locateByName(string $secretName): ?PermissionContract
21
    {
22 1
        $permission = static::query()->where('secret_name', $secretName)->first();
23 1
        return $permission instanceof PermissionContract ? $permission : null;
24
    }
25
}
26