
Public Member Functions | |
| __construct (spunQ_HttpEntryPoint $entryPoint) | |
| Constructor. | |
| getEntryPoint () | |
| Provides the spunQ_HttpEntryPoint this object is managing. | |
| getUrlTemplates () | |
| Gets all available url templates for the entry point. | |
| processDefaultValue ($variable, $typeName, $value) | |
| Provides the correct value for a default declaration. | |
| createHtmlLink (spunQ_Locale $locale, array $variables) | |
| Generates an http link pointing to this manager's entry point. | |
| generateUrlPart ($urlPart, $value) | |
| Generates a string part of an actual URL for a url part object. | |
| regexMatchToVariables (spunQ_DefaultUrlManagerUrlTemplate $urlTemplate, array $matches) | |
| Implementation for the function with same name in spunQ_IUrlTemplate. | |
Static Public Member Functions | |
| static | getDefaultTypeHandler (spunQ_Type $type, spunQ_Map $options=NULL) |
| Returns a type handler for a given type. | |
Protected Member Functions | |
| analyze () | |
| Creates spunQ_DefaultUrlManagerUrlTemplate objects for the entry point. | |
| analyzeUrlTemplate ($locale, $urlTemplate, &$localeVariables) | |
| Generates a url template object for a url definition. | |
| generateTemplatePart ($templateObject, $part, &$greedy) | |
| Creates a url template part object for a part of a url template. | |
| generateRegexTemplatePart ($templateObject, $part, &$greedy) | |
| Creates a url template part for a part containing a variable. | |
| generateStaticTemplatePart ($templateObject, $part) | |
| Creates a url template part for a part not containing a variable. | |
| processPropertyPath ($partObject) | |
| Populates members of a part object containing a variable. | |
| createSubpatternName ($part) | |
| Creates the name of a regex capture group for given string. | |
| getTypeHandler ($type, $options) | |
| Gets the type handler for given type. | |
Protected Attributes | |
| $entryPoint | |
| The spunQ_HttpEntryPoint this object is managing. | |
| $urlTemplates = array() | |
| Url templates of the entry point. | |
Has a handler class for each type to keep the code readable.
Definition at line 7 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::__construct | ( | spunQ_HttpEntryPoint $ | entryPoint | ) |
Constructor.
| $entryPoint | the entry point to manage. |
Definition at line 55 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::analyze | ( | ) | [protected] |
Creates spunQ_DefaultUrlManagerUrlTemplate objects for the entry point.
Called by the constructor to process all url definitions of the entry point. Will populate the $urlTemplates array.
Definition at line 212 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::analyzeUrlTemplate | ( | $ | locale, | |
| $ | urlTemplate, | |||
| &$ | localeVariables | |||
| ) | [protected] |
Generates a url template object for a url definition.
| $locale | The locale part of the url definition (as the en-uk part in .en-uk foo/bar). This is a string that can be empty (as in @url foo/bar.) | |
| $urlTemplate | The string representing the template (the foo/bar part in the examples above.) | |
| $localeVariables | Out-parameter that will be populated with variable name that are found in the template declaration. Warning: The variable names are inserted as keys into the array for performance reasons - not as values. So if the variable foo was found, this function will return array('foo'=>1). |
Definition at line 244 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::createHtmlLink | ( | spunQ_Locale $ | locale, | |
| array $ | variables | |||
| ) |
Generates an http link pointing to this manager's entry point.
If the returned value is not an absolute link (an absolute link is one starting with http://, for example), the returned value will already be run through spunQ_UrlManager::addGlobalPrefix().
| $locale | Locale to create link for. The manager will decide which url template to use according to this value. | |
| $variables | Variables available for the link generation. Missing variables are expected to be pulled from the entry points default declarations. |
Implements spunQ_IUrlManager.
Reimplemented in spunQ_WormholeUrlManager.
Definition at line 98 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::createSubpatternName | ( | $ | part | ) | [protected] |
Creates the name of a regex capture group for given string.
| $part | The name of the url template part to create pattern name for. |
Definition at line 348 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::generateRegexTemplatePart | ( | $ | templateObject, | |
| $ | part, | |||
| &$ | greedy | |||
| ) | [protected] |
Creates a url template part for a part containing a variable.
A variable is something like {user} for this url manager.
| $templateObject | The spunQ_DefaultUrlManagerUrlTemplate to create the part for. | |
| $part | String part of the template to process. Must contain a variable declaration (just like the example above). | |
| $greedy | Whether the generated regular expression should be greedy. |
Definition at line 297 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::generateStaticTemplatePart | ( | $ | templateObject, | |
| $ | part | |||
| ) | [protected] |
Creates a url template part for a part not containing a variable.
| $templateObject | The spunQ_DefaultUrlManagerUrlTemplate to create the part for. | |
| $part | String part of the template to process. |
Definition at line 315 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::generateTemplatePart | ( | $ | templateObject, | |
| $ | part, | |||
| &$ | greedy | |||
| ) | [protected] |
Creates a url template part object for a part of a url template.
| $templateObject | The spunQ_DefaultUrlManagerUrlTemplate to create the part for. | |
| $part | String part of the template to process. | |
| $greedy | Whether any possibly generated regular expressions should be greedy. |
Definition at line 276 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::generateUrlPart | ( | $ | urlPart, | |
| $ | value | |||
| ) |
Generates a string part of an actual URL for a url part object.
| $urlPart | The spunQ_DefaultUrlManagerUrlTemplatePart object to create the string for. | |
| $value | The value of the variable for this url part to convert. |
Definition at line 173 of file DefaultUrlManager.class.php.
| static spunQ_DefaultUrlManager::getDefaultTypeHandler | ( | spunQ_Type $ | type, | |
| spunQ_Map $ | options = NULL | |||
| ) | [static] |
Returns a type handler for a given type.
| $type | Type to get handler for. | |
| $options | Options for the type. Currently unused. |
Definition at line 15 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::getEntryPoint | ( | ) |
Provides the spunQ_HttpEntryPoint this object is managing.
Implements spunQ_IUrlManager.
Definition at line 64 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::getTypeHandler | ( | $ | type, | |
| $ | options | |||
| ) | [protected] |
Gets the type handler for given type.
Dedicated function for sub-classes to override. Just calls getDefaultTypeHandler() in its current implementation.
| $type | The type to get handler for. | |
| $options | Type options that might be relevant. |
Definition at line 360 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::getUrlTemplates | ( | ) |
Gets all available url templates for the entry point.
Implements spunQ_IUrlManager.
Definition at line 71 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::processDefaultValue | ( | $ | variable, | |
| $ | typeName, | |||
| $ | value | |||
| ) |
Provides the correct value for a default declaration.
The default declaration @default user 14 will return the user with id 14 for the default implementation. Parameters to this function would then be:
$variable: user $typeName: string spunQ.user.User.$value: 14 | $variable | Name of the variable to process value for. | |
| $typeName | Type of the variable as string (as declared in the entry point). | |
| $value | The default declaration that was given in the entry point's doc comment. |
Implements spunQ_IUrlManager.
Definition at line 78 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::processPropertyPath | ( | $ | partObject | ) | [protected] |
Populates members of a part object containing a variable.
This function has not been inlined for child classes to override.
| $partObject | The spunQ_DefaultUrlManagerUrlTemplatePart object to process. |
Reimplemented in spunQ_WormholeUrlManager.
Definition at line 329 of file DefaultUrlManager.class.php.
| spunQ_DefaultUrlManager::regexMatchToVariables | ( | spunQ_DefaultUrlManagerUrlTemplate $ | urlTemplate, | |
| array $ | matches | |||
| ) |
Implementation for the function with same name in spunQ_IUrlTemplate.
The url template will pass a call to its regexMatchToVariables() function to this one, since this class knows which template part can handle which part of the regex match.
| $urlTemplate | The url template that matched the url | |
| $matches | Matches of the regular expression as passed to the template by the request router. |
Definition at line 190 of file DefaultUrlManager.class.php.
spunQ_DefaultUrlManager::$entryPoint [protected] |
The spunQ_HttpEntryPoint this object is managing.
Definition at line 42 of file DefaultUrlManager.class.php.
spunQ_DefaultUrlManager::$urlTemplates = array() [protected] |
Url templates of the entry point.
Populated during analyze().
Definition at line 49 of file DefaultUrlManager.class.php.
1.5.9