private function getRoles(UserInterface $user, TokenInterface $token)
    {
        $roles = $user->getRoles();

        foreach ($token->getRoles(false) as $role) {
            if ($role instanceof SwitchUserRole) {
                $roles[] = $role;

                break;
            }
        }

        return $roles;
    }
private function getRoles(UserInterface $user, TokenInterface $token)
    {
        $roles = $user->getRoles();

        foreach ($token->getRoles(false) as $role) {
            if ($role instanceof SwitchUserRole) {
                $roles[] = $role;

                break;
            }
        }

        return $roles;
    }
private function getRoles ( UserInterface $ user , TokenInterface $ token ) { $ roles = $ user -> getRoles ( ) ; foreach ( $ token -> getRoles ( false ) as $ role ) { if ( $ role instanceof SwitchUserRole ) { $ roles [ ] = $ role ; break ; } } return $ roles ; }
Retrieves roles from user and appends SwitchUserRole if original token contained one.

@return array The user roles
Retrieves roles from user and appends SwitchUserRole if original token contained one .