Completed
Push — master ( 730998...f24d78 )
by Mahmoud
03:24
created

DeleteRoleTask   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A run() 0 7 1
1
<?php
2
3
namespace App\Containers\Authorization\Tasks;
4
5
use App\Containers\Authorization\Data\Repositories\RoleRepository;
6
use App\Port\Action\Abstracts\Action;
7
8
/**
9
 * Class DeleteRoleTask.
10
 *
11
 * @author Mahmoud Zalt <[email protected]>
12
 */
13
class DeleteRoleTask extends Action
14
{
15
16
    /**
17
     * @var  \App\Containers\Authorization\Data\Repositories\RoleRepository
18
     */
19
    private $roleRepository;
20
21
    /**
22
     * DeleteRoleTask constructor.
23
     *
24
     * @param \App\Containers\Authorization\Data\Repositories\RoleRepository $roleRepository
25
     */
26
    public function __construct(RoleRepository $roleRepository)
27
    {
28
        $this->roleRepository = $roleRepository;
29
    }
30
31
    /**
32
     * @param $roleId
33
     *
34
     * @return bool
35
     */
36
    public function run($roleId)
37
    {
38
        // delete the record from the roles table.
39
        $this->roleRepository->delete($roleId);
40
41
        return true;
42
    }
43
}
44