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

CreateAdminAction::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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