Passed
Push — master ( a569b2...1b7ab6 )
by Christian
03:49
created

FindPermission   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 11
c 1
b 1
f 0
dl 0
loc 19
ccs 11
cts 11
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A find() 0 17 2
1
<?php
2
3
namespace Omatech\Mage\Core\Repositories\Permissions;
4
5
use Omatech\Mage\Core\Domains\Permissions\Contracts\FindPermissionInterface;
6
use Omatech\Mage\Core\Repositories\PermissionBaseRepository;
7
8
class FindPermission extends PermissionBaseRepository implements FindPermissionInterface
9
{
10 5
    public function find(int $id)
11
    {
12 5
        $permission = $this->query()->find($id);
13
14 5
        if (null === $permission) {
15 1
            return;
16
        }
17
18 4
        $permission = app('mage.permissions')::fromArray([
0 ignored issues
show
Bug introduced by
The method fromArray() does not exist on Illuminate\Contracts\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        $permission = app('mage.permissions')::/** @scrutinizer ignore-call */ fromArray([

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
19 4
            'id'         => $permission->id,
20 4
            'name'       => $permission->name,
21 4
            'guard_name' => $permission->guard_name,
22 4
            'created_at' => $permission->created_at,
23 4
            'updated_at' => $permission->updated_at,
24
        ]);
25
26 4
        return $permission;
27
    }
28
}
29