PHP Interface Icicle\Http\Message\Uri

显示文件 Open project: icicleio/http Interface Usage Examples

Public Methods

Method Description
__toString ( ) : string Returns the URI string representation.
getFragment ( ) : string Returns the fragment portion of the URI (does not include # prefix).
getHost ( ) : string Returns the host or an empty string if no host is set.
getPath ( ) : string Returns the path portion of the URI.
getPort ( ) : integer Returns the port or 0 if no port is set and no scheme is set.
getQueryValue ( string $name ) : string Returns the value of the given query value. If multiple values were present for the named parameter, only the first value will be returned. Use getQueryValueAsArray() to return an array of all values for the particular parameter. Returns an empty string if the named parameter does not exist.
getQueryValueAsArray ( string $name ) : array Returns all values for the given query key name or an empty array if the key name does not exist.
getQueryValues ( ) : array Returns an array of the key/value pairs corresponding to the query portion of the URI.
getScheme ( ) : string Returns the scheme (without : or ://) or an empty string.
hasQueryValue ( string $name ) : boolean Determines if a query key exists for the given name.
withFragment ( string $fragment = null ) : Icicle\Http\Message\Uri Returns a new instance with the given fragment or null to remove fragment. Any # prefix should be trimmed.
withPort ( integer $port = null ) : Icicle\Http\Message\Uri Returns a new instance with the given port or null to remove port.
withQuery ( string $query = null ) : Icicle\Http\Message\Uri Returns a new instance with the given query string or null to remove query string. Any ? prefix should be trimmed.
withQueryValue ( string $name, string $value ) : Icicle\Http\Message\Uri Returns a new instance with the given name and value pair in the query string (i.e., $name=$value)
withScheme ( string $scheme = null ) : Icicle\Http\Message\Uri Returns a new instance with the given scheme or no scheme if null. :// or : suffix should be trimmed.
withUser ( string $user, string $password = null ) : Icicle\Http\Message\Uri Returns a new instance with the given user and password. Use null for $user to remove user info.
withoutQueryValue ( string $name ) : Icicle\Http\Message\Uri Returns a new instance with the given key name removed from the query string.

Method Details

__toString() public method

Returns the URI string representation.
public __toString ( ) : string
return string

getFragment() public method

Returns the fragment portion of the URI (does not include # prefix).
public getFragment ( ) : string
return string

getHost() public method

Returns the host or an empty string if no host is set.
public getHost ( ) : string
return string

getPath() public method

Returns the path portion of the URI.
public getPath ( ) : string
return string Path including / prefix unless path is empty, then an empty string is returned.

getPort() public method

Returns the port or 0 if no port is set and no scheme is set.
public getPort ( ) : integer
return integer

getQueryValue() public method

Returns the value of the given query value. If multiple values were present for the named parameter, only the first value will be returned. Use getQueryValueAsArray() to return an array of all values for the particular parameter. Returns an empty string if the named parameter does not exist.
public getQueryValue ( string $name ) : string
$name string
return string

getQueryValueAsArray() public method

Returns all values for the given query key name or an empty array if the key name does not exist.
public getQueryValueAsArray ( string $name ) : array
$name string
return array

getQueryValues() public method

Returns an array of the key/value pairs corresponding to the query portion of the URI.
public getQueryValues ( ) : array
return array

getScheme() public method

Returns the scheme (without : or ://) or an empty string.
public getScheme ( ) : string
return string

hasQueryValue() public method

Determines if a query key exists for the given name.
public hasQueryValue ( string $name ) : boolean
$name string
return boolean

withFragment() public method

Returns a new instance with the given fragment or null to remove fragment. Any # prefix should be trimmed.
public withFragment ( string $fragment = null ) : Icicle\Http\Message\Uri
$fragment string
return Icicle\Http\Message\Uri

withPort() public method

Returns a new instance with the given port or null to remove port.
public withPort ( integer $port = null ) : Icicle\Http\Message\Uri
$port integer
return Icicle\Http\Message\Uri

withQuery() public method

Returns a new instance with the given query string or null to remove query string. Any ? prefix should be trimmed.
public withQuery ( string $query = null ) : Icicle\Http\Message\Uri
$query string
return Icicle\Http\Message\Uri

withQueryValue() public method

Returns a new instance with the given name and value pair in the query string (i.e., $name=$value)
public withQueryValue ( string $name, string $value ) : Icicle\Http\Message\Uri
$name string
$value string
return Icicle\Http\Message\Uri

withScheme() public method

Returns a new instance with the given scheme or no scheme if null. :// or : suffix should be trimmed.
public withScheme ( string $scheme = null ) : Icicle\Http\Message\Uri
$scheme string
return Icicle\Http\Message\Uri

withUser() public method

Returns a new instance with the given user and password. Use null for $user to remove user info.
public withUser ( string $user, string $password = null ) : Icicle\Http\Message\Uri
$user string
$password string
return Icicle\Http\Message\Uri

withoutQueryValue() public method

Returns a new instance with the given key name removed from the query string.
public withoutQueryValue ( string $name ) : Icicle\Http\Message\Uri
$name string
return Icicle\Http\Message\Uri