ExistsPermission::exists()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Omatech\Mage\Core\Repositories\Permissions;
4
5
use Omatech\Mage\Core\Domains\Permissions\Contracts\ExistsPermissionInterface;
6
use Omatech\Mage\Core\Domains\Permissions\Contracts\PermissionInterface;
7
use Omatech\Mage\Core\Repositories\PermissionBaseRepository;
8
9
class ExistsPermission extends PermissionBaseRepository implements ExistsPermissionInterface
10
{
11
    /**
12
     * @param PermissionInterface $permission
13
     * @return bool
14
     */
15 21
    public function exists(PermissionInterface $permission): bool
16
    {
17 21
        return $this->query()
0 ignored issues
show
Bug introduced by
The method exists() does not exist on Illuminate\Database\Eloquent\Builder. Did you maybe mean canUseExistsForExistenceCheck()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
18 21
            ->where('name', $permission->getName())
19 21
            ->orWhere('id', $permission->getId())
20 21
            ->exists();
21
    }
22
}
23