Completed
Push — master ( 63d559...0e0340 )
by Mahmoud
03:20
created

UpdateUserAction::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace App\Containers\User\Actions;
4
5
use App\Containers\Authentication\Tasks\GetAuthenticatedUserTask;
6
use App\Containers\User\Tasks\UpdateUserTask;
7
use App\Ship\Parents\Actions\Action;
8
9
/**
10
 * Class UpdateUserAction.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class UpdateUserAction extends Action
15
{
16
17
    /**
18
     * @param null $password
19
     * @param null $name
20
     * @param null $email
21
     * @param null $gender
22
     * @param null $birth
23
     *
24
     * @return  mixed
25
     */
26
    public function run($password = null, $name = null, $email = null, $gender = null, $birth = null)
27
    {
28
        // user can only update himself
29
        $userId = $this->call(GetAuthenticatedUserTask::class)->id;
30
31
        $user = $this->call(UpdateUserTask::class, [$userId, $password, $name, $email, $gender, $birth]);
32
33
        return $user;
34
    }
35
}
36