Completed
Push — master ( 698be1...dfb070 )
by Mahmoud
05:54
created

AssignUserToRoleTask::__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\Authorization\Tasks;
4
5
use App\Containers\User\Models\User;
6
use App\Port\Task\Abstracts\Task;
7
8
/**
9
 * Class AssignUserToRoleTask.
10
 *
11
 * @author Mahmoud Zalt <[email protected]>
12
 */
13
class AssignUserToRoleTask extends Task
14
{
15
16
17
    /**
18
     * @param \App\Containers\User\Models\User $user
19
     * @param array                            $roles
20
     *
21
     * @return  \App\Containers\User\Models\User
22
     */
23
    public function run(User $user, array $roles)
24
    {
25
        $user = $user->assignRole($roles);
26
27
        return $user;
28
    }
29
30
}
31