sfRoute represents a route.
Method Summary
-
bind($context, $parameters)
Binds the current route for a given context and parameters.
-
compile()
Compiles the current route instance.
-
compileForSeparator($separator, $regexSeparator)
-
compileForText($separator, $text)
-
compileForVariable($separator, $name, $variable)
-
fixDefaults()
-
fixRequirements()
-
fixSuffix()
-
string
generate($params, $context = array(), (Boolean) $absolute = false)
Generates a URL from the given parameters.
-
generateStarParameter($url, $defaults, $parameters)
-
generateWithTokens($parameters)
Generates a URL for the given parameters by using the route tokens.
-
getDefaultOptions()
-
getDefaultParameters()
-
array
getDefaults()
Returns the compiled defaults.
-
array
getOptions()
Returns the compiled options.
-
string
getPattern()
Returns the compiled pattern.
-
string
getRegex()
Returns the compiled regex.
-
array
getRequirements()
Returns the compiled requirements.
-
array
getTokens()
Returns the compiled tokens.
-
array
getVariables()
Returns the compiled variables.
-
hasStarParameter()
-
initializeOptions()
-
Boolean
isBound()
Returns true if the form is bound to input values.
-
Boolean
matchesParameters($params, $context = array())
Returns true if the parameters matches this route, false otherwise.
-
array
matchesUrl($url, $context = array())
Returns true if the URL matches this route, false otherwise.
-
mergeArrays($arr1, $arr2)
-
parseStarParameter($star)
-
postCompile()
Post-compiles a route.
-
preCompile()
Pre-compiles a route.
-
serialize()
-
setDefaultOptions($options)
-
setDefaultParameters($parameters)
-
tokenize()
Tokenizes the route.
-
Boolean
tokenizeBufferAfter(&$buffer, &$tokens, &$afterASeparator, &$currentSeparator, $buffer, $tokens, (Boolean) $afterASeparator, $currentSeparator)
Tokenizes the buffer after default logic is applied.
-
Boolean
tokenizeBufferBefore(&$buffer, &$tokens, &$afterASeparator, &$currentSeparator, $buffer, $tokens, (Boolean) $afterASeparator, $currentSeparator)
Tokenizes the buffer before default logic is applied.
-
unserialize($data)
-
__construct($pattern, $defaults = array(), $requirements = array(), $options = array())
Constructor.
Method Details
-
bind ($context, $parameters)
Browse code
| $context |
The context
|
| $parameters |
The parameters
|
Binds the current route for a given context and parameters.
-
Compiles the current route instance.
-
compileForSeparator ($separator, $regexSeparator)
Browse code
| $separator |
|
| $regexSeparator |
|
-
compileForText ($separator, $text)
Browse code
-
compileForVariable ($separator, $name, $variable)
Browse code
| $separator |
|
| $name |
|
| $variable |
|
-
-
-
-
(string) generate ($params, $context = array(), (Boolean) $absolute = false)
Browse code
| $params |
The parameter values
|
| $context |
The context
|
| $absolute |
Whether to generate an absolute URL
|
Generates a URL from the given parameters.
returns The generated URL
-
generateStarParameter ($url, $defaults, $parameters)
Browse code
| $url |
|
| $defaults |
|
| $parameters |
|
-
generateWithTokens ($parameters)
Browse code
| $parameters |
An array of parameters
|
Generates a URL for the given parameters by using the route tokens.
-
-
getDefaultParameters ()
Browse code
-
(array) getDefaults ()
Browse code
Returns the compiled defaults.
returns The compiled defaults
-
Returns the compiled options.
returns The compiled options
-
(string) getPattern ()
Browse code
Returns the compiled pattern.
returns The compiled pattern
-
Returns the compiled regex.
returns The compiled regex
-
(array) getRequirements ()
Browse code
Returns the compiled requirements.
returns The compiled requirements
-
Returns the compiled tokens.
returns The compiled tokens
-
(array) getVariables ()
Browse code
Returns the compiled variables.
returns The compiled variables
-
-
-
Returns true if the form is bound to input values.
returns true if the form is bound to input values, false otherwise
-
(Boolean) matchesParameters ($params, $context = array())
Browse code
| $params |
The parameters
|
| $context |
The context
|
Returns true if the parameters matches this route, false otherwise.
returns true if the parameters matches this route, false otherwise.
-
(array) matchesUrl ($url, $context = array())
Browse code
| $url |
The URL
|
| $context |
The context
|
Returns true if the URL matches this route, false otherwise.
returns An array of parameters
-
mergeArrays ($arr1, $arr2)
Browse code
-
parseStarParameter ($star)
Browse code
-
Post-compiles a route.
-
Pre-compiles a route.
-
-
setDefaultOptions ($options)
Browse code
-
setDefaultParameters ($parameters)
Browse code
-
Tokenizes the route.
-
(Boolean) tokenizeBufferAfter (&$buffer, &$tokens, &$afterASeparator, &$currentSeparator, $buffer, $tokens, (Boolean) $afterASeparator, $currentSeparator)
Browse code
| &$buffer |
|
| &$tokens |
|
| &$afterASeparator |
|
| &$currentSeparator |
|
| $buffer |
The current route buffer
|
| $tokens |
An array of current tokens
|
| $afterASeparator |
Whether the buffer is just after a separator
|
| $currentSeparator |
The last matched separator
|
Tokenizes the buffer after default logic is applied.
This method must return false if the buffer has not been parsed.
returns true if a token has been generated, false otherwise
-
(Boolean) tokenizeBufferBefore (&$buffer, &$tokens, &$afterASeparator, &$currentSeparator, $buffer, $tokens, (Boolean) $afterASeparator, $currentSeparator)
Browse code
| &$buffer |
|
| &$tokens |
|
| &$afterASeparator |
|
| &$currentSeparator |
|
| $buffer |
The current route buffer
|
| $tokens |
An array of current tokens
|
| $afterASeparator |
Whether the buffer is just after a separator
|
| $currentSeparator |
The last matched separator
|
Tokenizes the buffer before default logic is applied.
This method must return false if the buffer has not been parsed.
returns true if a token has been generated, false otherwise
-
-
__construct ($pattern, $defaults = array(), $requirements = array(), $options = array())
Browse code
| $pattern |
The pattern to match
|
| $defaults |
An array of default parameter values
|
| $requirements |
An array of requirements for parameters (regexes)
|
| $options |
An array of options
|
Constructor.
Available options: * variable_prefixes: An array of characters that starts a variable name (: by default)
* segment_separators: An array of allowed characters for segment separators (/ and . by default)
* variable_regex: A regex that match a valid variable name ([\w\d_]+ by default)
* generate_shortest_url: Whether to generate the shortest URL possible (true by default)
* extra_parameters_as_query_string: Whether to generate extra parameters as a query string
|