Code Duplication    Length = 16-16 lines in 2 locations

app/Containers/Authorization/Actions/AssignUserToRoleAction.php 1 location

@@ 24-39 (lines=16) @@
21
     *
22
     * @return  \App\Containers\User\Models\User
23
     */
24
    public function run($user, $rolesIds)
25
    {
26
        if (!$user instanceof User) {
27
            $user = $this->call(FindUserByIdTask::class, [$user]);
28
        }
29
30
        if (!is_array($rolesIds)) {
31
            $rolesIds = [$rolesIds];
32
        }
33
34
        foreach ($rolesIds as $roleId) {
35
            $roles[] = $this->call(GetRoleTask::class, [$roleId]);
36
        }
37
38
        return $this->call(AssignUserToRoleTask::class, [$user, $roles]);
39
    }
40
}
41

app/Containers/Authorization/Actions/SyncUserRolesAction.php 1 location

@@ 65-80 (lines=16) @@
62
     *
63
     * @return  \App\Containers\User\Models\User
64
     */
65
    public function run($user, $rolesIds)
66
    {
67
        if (!$user instanceof User) {
68
            $user = $this->call(FindUserByIdTask::class, [$user]);
69
        }
70
71
        if (!is_array($rolesIds)) {
72
            $rolesIds = [$rolesIds];
73
        }
74
75
        foreach ($rolesIds as $roleId) {
76
            $roles[] = $this->call(GetRoleTask::class, [$roleId]);
77
        }
78
79
        return $this->call(SyncUserRolesTask::class, [$user, $roles]);
80
    }
81
}
82