spunQ_DefaultUrlManagerUrlTemplate Class Reference

Url template of the default url manager. More...

Inheritance diagram for spunQ_DefaultUrlManagerUrlTemplate:

spunQ_IUrlTemplate

List of all members.

Public Member Functions

 __construct ($localeShortName, $entryPoint)
 Constructor.
 getLocaleShortName ()
 Provides the $shortName of the spunQ_Locale for this template.
 prependPart (spunQ_DefaultUrlManagerUrlTemplatePart $part)
 Prepends a part object to its list of url parts.
 toUrl ($variables)
 Generates a url out of this template with given variables.
 getVariableNames ()
 Provides the names of all variables contained in this template.
 getPartForVariable ($variable)
 Gets the part object handling a varible.
 getEntryPoint ()
 Provides the entry point this template belongs to.
 getUrlParts ()
 Returns all parts of this url.
 getLocale ()
 Locale this url template is for.
 toRegex ()
 Provides a regular expression a url must match.
 toHumanReadableString ()
 Converts the url template to a human-readable string.
 regexMatchToVariables (array $matches)
 Parses variables out of a regular expression match of the url.

Private Attributes

 $parts = array()
 Url parts.
 $localeShortName
 $shortName of the spunQ_Locale this template was declared for.
 $entryPoint
 spunQ_HttpEntryPoint this template was defined in.


Detailed Description

Url template of the default url manager.

Definition at line 6 of file DefaultUrlManagerUrlTemplate.class.php.


Constructor & Destructor Documentation

spunQ_DefaultUrlManagerUrlTemplate::__construct ( localeShortName,
entryPoint 
)

Constructor.

Parameters:
$localeShortName $shortName of the spunQ_Locale this template was declared for. Can be an empty string to indicate default locale.
$entryPoint 

Definition at line 33 of file DefaultUrlManagerUrlTemplate.class.php.


Member Function Documentation

spunQ_DefaultUrlManagerUrlTemplate::getEntryPoint (  ) 

Provides the entry point this template belongs to.

Returns:
spunQ_HttpEntryPoint

Implements spunQ_IUrlTemplate.

Definition at line 110 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::getLocale (  ) 

Locale this url template is for.

Returns:
spunQ_Locale

Implements spunQ_IUrlTemplate.

Definition at line 124 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::getLocaleShortName (  ) 

Provides the $shortName of the spunQ_Locale for this template.

Can be an empty string to indicate default locale.

Returns:
string

Definition at line 44 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::getPartForVariable ( variable  ) 

Gets the part object handling a varible.

Parameters:
$variable Name of the variable to get template part for.
Returns:
spunQ_DefaultUrlManagerUrlTemplatePart Or NULL if the variable does not ocur within this url template.

Definition at line 98 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::getUrlParts (  ) 

Returns all parts of this url.

The parts are used to sort the templates automatically in the spunQ_UrlManager.

Returns:
array<spunQ_IUrlTemplatePart>

Implements spunQ_IUrlTemplate.

Definition at line 117 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::getVariableNames (  ) 

Provides the names of all variables contained in this template.

Needed to check validity of variable declarations of the entry point.

Returns:
array<string>

Definition at line 82 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::prependPart ( spunQ_DefaultUrlManagerUrlTemplatePart part  ) 

Prepends a part object to its list of url parts.

Could have been appendPart, but the implementation in spunQ_DefaultUrlManager works from last part to first.

Parameters:
$part Part object to prepend.
Returns:
spunQ_DefaultUrlManagerUrlTemplate $this

Definition at line 55 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::regexMatchToVariables ( array $  matches  ) 

Parses variables out of a regular expression match of the url.

Parameters:
$matches Result of the preg_match() performed by the url router with the regular expression of this url part (acquired by call to toRegex()).
Returns:
array Mapping variable names to their value. It should contain the minimum variables set required to enter its entry point. Any missing values will be supplemented with the entry point's declared default values.
Matching the regex alone is not sufficient for the template to be able to parse a url. If the url could not be parsed (although it obviously matched the regex), the function will return false.

Implements spunQ_IUrlTemplate.

Definition at line 157 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::toHumanReadableString (  ) 

Converts the url template to a human-readable string.

Will most likely return the string as it was declared in the @url part of the entry point.

Returns:
string

Implements spunQ_IUrlTemplate.

Definition at line 146 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::toRegex (  ) 

Provides a regular expression a url must match.

The regex must escape exclamation marks in addition to any other special characters. This means: if preg_quote() is used, make sure the second parameter is an exclamation mark (!).

See also:
regexMatchToVariables()
Returns:
string

Implements spunQ_IUrlTemplate.

Definition at line 135 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::toUrl ( variables  ) 

Generates a url out of this template with given variables.

Parameters:
$variables Array of values indexed by variable name.
Returns:
string

Definition at line 65 of file DefaultUrlManagerUrlTemplate.class.php.


Member Data Documentation

spunQ_DefaultUrlManagerUrlTemplate::$entryPoint [private]

spunQ_HttpEntryPoint this template was defined in.

Type:
spunQ_HttpEntryPoint

Definition at line 25 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::$localeShortName [private]

$shortName of the spunQ_Locale this template was declared for.

Can be an empty string to indicate default locale.

Type:
string

Definition at line 19 of file DefaultUrlManagerUrlTemplate.class.php.

spunQ_DefaultUrlManagerUrlTemplate::$parts = array() [private]

Url parts.

Type:
array<spunQ_DefaultUrlManagerUrlTemplatePart>

Definition at line 12 of file DefaultUrlManagerUrlTemplate.class.php.


The documentation for this class was generated from the following file:

Generated on Fri Jul 1 11:12:39 2011 for spunQ3 by  doxygen 1.5.9