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

UniqueRole   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 5
c 1
b 1
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A unique() 0 6 1
1
<?php
2
3
namespace Omatech\Mage\Core\Repositories\Roles;
4
5
use Omatech\Mage\Core\Domains\Roles\Contracts\RoleInterface;
6
use Omatech\Mage\Core\Domains\Roles\Contracts\UniqueRoleInterface;
7
use Omatech\Mage\Core\Repositories\RoleBaseRepository;
8
9
class UniqueRole extends RoleBaseRepository implements UniqueRoleInterface
10
{
11 6
    public function unique(RoleInterface $role): bool
12
    {
13 6
        return $this->query()
14 6
            ->where('name', $role->getName())
15 6
            ->where('id', '!=', $role->getId())
16 6
            ->exists();
17
    }
18
}
19