DeleteUserAction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 2
1
<?php
2
3
namespace App\Containers\User\Actions;
4
5
use App\Containers\Authentication\Tasks\GetAuthenticatedUserTask;
6
use App\Containers\User\Tasks\DeleteUserTask;
7
use App\Containers\User\Tasks\FindUserByIdTask;
8
use App\Ship\Parents\Actions\Action;
9
10
/**
11
 * Class DeleteUserAction.
12
 *
13
 * @author Mahmoud Zalt <[email protected]>
14
 */
15
class DeleteUserAction extends Action
16
{
17
18
    /**
19
     * @param $userId
20
     *
21
     * @return  bool
22
     */
23
    public function run($userId = null)
24
    {
25
        $userId = $userId ? : $this->call(GetAuthenticatedUserTask::class)->id;
26
27
        $user = $this->call(FindUserByIdTask::class, [$userId]);
28
29
        $this->call(DeleteUserTask::class, [$user]);
30
31
        return $user;
32
    }
33
}
34