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

FindPermission::find()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 2
eloc 10
c 1
b 1
f 0
nc 2
nop 1
dl 0
loc 17
ccs 11
cts 11
cp 1
crap 2
rs 9.9332
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