Class NUri


URI Syntax (RFC 3986).

 http://user:password@nettephp.com:8042/en/manual.html?name=param#fragment
 \__/^^^\_____________________________/\_____________/^\________/^\______/
   |                    |                     |            |         |
 scheme             authority               path         query    fragment

  • authority: [user[:password]@]host[:port]
  • hostUri: http://user:password@nettephp.com:8042

NObject
   |
   --NFreezableObject
      |
      --NUri

Direct Known Sub-classes:

Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Web/Uri.php (line 55)
Public Method Summary
NUri
__construct ([string $uri = NULL])
void
appendQuery (string|array $value)
Appends the query part of URI.
void
Transform to canonical form.
string
Returns the entire URI including query string and fragment.
string
Returns the [user[:pass]@]host[:port] part of URI.
string
Returns the fragment part of URI.
string
getHost ()
Returns the host part of URI.
string
Returns the scheme and authority part of URI.
void
getPass ()
string
Returns the password part of URI.
string
getPath ()
Returns the path part of URI.
string
getPort ()
Returns the port part of URI.
string
Returns the query part of URI.
string
Returns the scheme part of URI.
string
getUser ()
Returns the user name part of URI.
bool
isEqual (string $uri)
URI comparsion (this object must be in canonical form).
NUri
setFragment (string $value)
Sets the fragment part of URI.
NUri
setHost (string $value)
Sets the host part of URI.
void
setPass ($value)
NUri
setPassword (string $value)
Sets the password part of URI.
NUri
setPath (string $value)
Sets the path part of URI.
NUri
setPort (string $value)
Sets the port part of URI.
NUri
setQuery (string|array $value)
Sets the query part of URI.
NUri
setScheme (string $value)
Sets the scheme part of URI.
NUri
setUser (string $value)
Sets the user name part of URI.
static string
unescape (string $s, [string $reserved = '%;/?:@&=+$,'])
Similar to rawurldecode, but preserve reserved chars encoded.
string
Methods Inherited From NFreezableObject
freeze(), isFrozen(), updating(), __clone()
Methods Inherited From NObject
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Variable Summary
static array $defaultPorts array( 'http' => 80, 'https' => 443, 'ftp' => 21, 'news' => 119,...

line 58


Method Details

line 96

__construct

public NUri __construct ([string $uri = NULL])

Input
string $uri URL
Output
NUri  
Throws
throws InvalidArgumentException

line 310

appendQuery

public void appendQuery (string|array $value)

Appends the query part of URI.

Input
string|array $value
Output
void  

line 434

canonicalize

public void canonicalize ()

Transform to canonical form.

Output
void  

line 359

getAbsoluteUri

public string getAbsoluteUri ()

Returns the entire URI including query string and fragment.

Output
string  

line 372

getAuthority

public string getAuthority ()

Returns the [user[:pass]@]host[:port] part of URI.

Output
string  

line 348

getFragment

public string getFragment ()

Returns the fragment part of URI.

Output
string  

line 234

getHost

public string getHost ()

Returns the host part of URI.

Output
string  

line 392

getHostUri

public string getHostUri ()

Returns the scheme and authority part of URI.

Output
string  

line 209

getPass

public void getPass ()

Output
void  
Tags
Deprecated

line 189

getPassword

public string getPassword ()

Returns the password part of URI.

Output
string  

line 284

getPath

public string getPath ()

Returns the path part of URI.

Output
string  

line 259

getPort

public string getPort ()

Returns the port part of URI.

Output
string  

line 323

getQuery

public string getQuery ()

Returns the query part of URI.

Output
string  

line 139

getScheme

public string getScheme ()

Returns the scheme part of URI.

Output
string  

line 164

getUser

public string getUser ()

Returns the user name part of URI.

Output
string  

line 404

isEqual

public bool isEqual (string $uri)

URI comparsion (this object must be in canonical form).

Input
string $uri
Output
bool  

line 335

setFragment

public NUri setFragment (string $value)

Sets the fragment part of URI.

Input
string $value
Output
NUri provides a fluent interface

line 221

setHost

public NUri setHost (string $value)

Sets the host part of URI.

Input
string $value
Output
NUri provides a fluent interface

line 199

setPass

public void setPass ($value)

Input
$value
Output
void  
Tags
Deprecated

line 176

setPassword

public NUri setPassword (string $value)

Sets the password part of URI.

Input
string $value
Output
NUri provides a fluent interface

line 271

setPath

public NUri setPath (string $value)

Sets the path part of URI.

Input
string $value
Output
NUri provides a fluent interface

line 246

setPort

public NUri setPort (string $value)

Sets the port part of URI.

Input
string $value
Output
NUri provides a fluent interface

line 296

setQuery

public NUri setQuery (string|array $value)

Sets the query part of URI.

Input
string|array $value
Output
NUri provides a fluent interface

line 126

setScheme

public NUri setScheme (string $value)

Sets the scheme part of URI.

Input
string $value
Output
NUri provides a fluent interface

line 151

setUser

public NUri setUser (string $value)

Sets the user name part of URI.

Input
string $value
Output
NUri provides a fluent interface

line 466

unescape

public static string unescape (string $s, [string $reserved = '%;/?:@&=+$,'])

Similar to rawurldecode, but preserve reserved chars encoded.

Input
string $s to decode
string $reserved reserved characters
Output
string  

line 453

__toString

public string __toString ()

Output
string