DeletePermission   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 17
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A delete() 0 10 1
1
<?php
2
3
namespace Omatech\Mage\Core\Repositories\Permissions;
4
5
use Omatech\Mage\Core\Domains\Permissions\Contracts\DeletePermissionInterface;
6
use Omatech\Mage\Core\Domains\Permissions\Contracts\PermissionInterface;
7
use Omatech\Mage\Core\Events\Permissions\PermissionDeleted;
8
use Omatech\Mage\Core\Repositories\PermissionBaseRepository;
9
10
class DeletePermission extends PermissionBaseRepository implements DeletePermissionInterface
11
{
12
    /**
13
     * @param PermissionInterface $permission
14
     * @return bool
15
     */
16 3
    public function delete(PermissionInterface $permission): bool
17
    {
18 3
        $isDeleted = $this->query()
19 3
            ->where('id', $permission->getId())
20 3
            ->delete();
21
22 3
        event(new PermissionDeleted($permission, $isDeleted > 0));
23
24 3
        return $isDeleted > 0;
25
    }
26
}
27