DeleteUserAction::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
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