public function withUserInfo($user, $password = null)
    {
        $username = rawurlencode($user);

        if (strlen($username) > 0) {
            return $this->with('userInfo', $this->constructString([
                '%s%s'  => $username,
                '%s:%s' => rawurlencode($password),
            ]));
        }

        return $this->with('userInfo', '');
    }
public function withUserInfo($user, $password = null)
    {
        $username = rawurlencode($user);

        if (strlen($username) > 0) {
            return $this->with('userInfo', $this->constructString([
                '%s%s'  => $username,
                '%s:%s' => rawurlencode($password),
            ]));
        }

        return $this->with('userInfo', '');
    }
public function withUserInfo ( $ user , $ password = null ) { $ username = rawurlencode ( $ user ) ; if ( strlen ( $ username ) > 0 ) { return $ this -> with ( 'userInfo' , $ this -> constructString ( [ '%s%s' => $ username , '%s:%s' => rawurlencode ( $ password ) , ] ) ) ; } return $ this -> with ( 'userInfo' , '' ) ; }
Returns a URI instance with the specified user information.

Note that the password is optional, but unless an username is provided,
the password will be ignored. Note that this method assumes that neither
the username nor the password contains encoded characters. Thus, all
encoded characters will be double encoded, if present. An empty username
can be used to remove the user information.

@param string $user The username to use for the authority component
@param string|null $password The password associated with the user
@return static A new instance with the specified user information
Returns a URI instance with the specified user information .