public static function invite(UserId $anId, UserEmail $anEmail, array $userRoles)
    {
        $user = new static($anId, $anEmail, $userRoles);
        $user->invitationToken = new UserToken();
        $user->publish(
            new UserInvited(
                $user->id(),
                $user->email(),
                $user->invitationToken()
            )
        );

        return $user;
    }
public static function invite(UserId $anId, UserEmail $anEmail, array $userRoles)
    {
        $user = new static($anId, $anEmail, $userRoles);
        $user->invitationToken = new UserToken();
        $user->publish(
            new UserInvited(
                $user->id(),
                $user->email(),
                $user->invitationToken()
            )
        );

        return $user;
    }
public static function invite ( UserId $ anId , UserEmail $ anEmail , array $ userRoles ) { $ user = new static ( $ anId , $ anEmail , $ userRoles ) ; $ user -> invitationToken = new UserToken ( ) ; $ user -> publish ( new UserInvited ( $ user -> id ( ) , $ user -> email ( ) , $ user -> invitationToken ( ) ) ) ; return $ user ; }
Invites user.

@param UserId    $anId      The id
@param UserEmail $anEmail   The email
@param array     $userRoles Array which contains the roles

@return static
Invites user .