Class that resolves a path in the URI or other part of the request to a controller/action.

Also allows the type of response that is desired to be controlled based on input. Individual matches can make modifications to the routing path to be passed to other rules.

Rules will continue matching until a XenForo_RouteMatch object is returned that has a controller name specified.

package XenForo_Mvc

 Methods

Adds a new routing rule to the end of the chain or overwrites an existing rule by name.

addRule(\XenForo_Route_Interface $route, string $name) : \XenForo_Router

Parameters

$route

\XenForo_Route_Interface

Routing rule

$name

string

Name of the rule. If it already exists, it is overwritten.

Returns

\XenForo_RouterFluent interface ($this)

Gets a route match object.

getRouteMatch(string $controllerName, string | false $action, string $majorSection, string $minorSection) : \XenForo_RouteMatch

Parameters

$controllerName

string

$action

stringfalse

$majorSection

string

$minorSection

string

Returns

Gets the path the to be routed based on the URL of the request

getRoutePath(\Zend_Controller_Request_Http $request) : string

Parameters

$request

\Zend_Controller_Request_Http

Request object

Returns

stringRouting path

Get the current routing rules

getRules() : array

Returns

array

Prepares routing for a link in the form of <sub component>/<data.id>/<action>.

getSubComponentAction(array $subComponents, string $routePath, \Zend_Controller_Request_Http $request, string $controllerOverride) : string | false

Note that the prefix has already been removed from this link.

Parameters

$subComponents

array

$routePath

string

$request

\Zend_Controller_Request_Http

$controllerOverride

string

Current controller passed in by referenced; overridden if sub-component chooses

Returns

stringfalseString of action if sub-component matched; false otherwise

Match against the rules stack.

match(\Zend_Controller_Request_Http $request) : \XenForo_RouteMatch | false

If no match can be found, the getNotFoundError() handler is invoked.

Parameters

$request

\Zend_Controller_Request_Http

Request object

Returns

\XenForo_RouteMatchfalseFinal information (including controller and action) about where to route to

Reset (remove) all routing rules.

resetRules() : \XenForo_Router

Returns

\XenForo_RouterFluent interface ($this)

Checks for the presence of 'page-x' as the action component of a route

resolveActionAsPageNumber(string $action, \Zend_Controller_Request_Http $request) : string

Parameters

$action

string

$request

\Zend_Controller_Request_Http

Returns

string

Resolves an action with an integer or a string parameter, such as in situations where a slug is an optional component.

resolveActionWithIntegerOrStringParam(\strign $routePath, \Zend_Controller_Request_Http $request, string $intParamName, string $stringParamName) 

Note that .<int>/<action> and <string>/<action> will work, but <action> on its own will be matched as a string.</p> <p>This method is not an ideal function to use when you are not guaranteed to have data.</p></p> <h3>Parameters</h3> <div class="subelement argument"> <h4>$routePath</h4> <code>\strign</code></div> <div class="subelement argument"> <h4>$request</h4> <code>\Zend_Controller_Request_Http</code></div> <div class="subelement argument"> <h4>$intParamName</h4> <code>string</code><p>Name of the parameter to set if int is found</p></div> <div class="subelement argument"> <h4>$stringParamName</h4> <code>string</code><p>Name of the parameter to set if string is found</p></div> </div></div> </div> <a name="resolveActionWithIntegerParam" id="resolveActionWithIntegerParam"></a><div class="element clickable method public resolveActionWithIntegerParam" data-toggle="collapse" data-target=".resolveActionWithIntegerParam .collapse"> <h2>Resolves the action from a route that looks like name.123/action and sets the "123" param into the specified parameter name.</h2> <pre>resolveActionWithIntegerParam(string $routePath, \Zend_Controller_Request_Http $request, string $paramName, string $defaultActionWithParam) : string</pre> <div class="labels"></div> <div class="row collapse"><div class="detail-description"> <p class="long_description"><p>Supports name.123/action1/action2 (returns "action1/action2"). If given "action1/action2", this will return the full string as the action as long as action1 does not have a "." in it.</p></p> <h3>Parameters</h3> <div class="subelement argument"> <h4>$routePath</h4> <code>string</code><p>Full path to route against. This should not include a prefix.</p></div> <div class="subelement argument"> <h4>$request</h4> <code>\Zend_Controller_Request_Http</code><p>Request object</p></div> <div class="subelement argument"> <h4>$paramName</h4> <code>string</code><p>Name of the parameter to be registered with the request object (if found)</p> </div> <div class="subelement argument"> <h4>$defaultActionWithParam</h4> <code>string</code><p>If there's no action and there is an int param, use this as the default action</p> </div> <h3>Returns</h3> <div class="subelement response"> <code>string</code>The requested action</div> </div></div> </div> <a name="resolveActionWithStringParam" id="resolveActionWithStringParam"></a><div class="element clickable method public resolveActionWithStringParam" data-toggle="collapse" data-target=".resolveActionWithStringParam .collapse"> <h2>Resolves the action from a route that may have a string parameter.</h2> <pre>resolveActionWithStringParam(string $routePath, \Zend_Controller_Request_Http $request, string $paramName) : string</pre> <div class="labels"></div> <div class="row collapse"><div class="detail-description"> <p class="long_description"><p>If there are no slashes, then an action is assumed. If there is a slash, then the first item is considered the string param.</p> <p>For example: list => "list" action. blah/list => "list" action, with "blah" param.</p></p> <h3>Parameters</h3> <div class="subelement argument"> <h4>$routePath</h4> <code>string</code><p>Full path to route against. This should not include a prefix.</p></div> <div class="subelement argument"> <h4>$request</h4> <code>\Zend_Controller_Request_Http</code><p>Request object</p></div> <div class="subelement argument"> <h4>$paramName</h4> <code>string</code><p>Name of the parameter to be registered with the request object (if found)</p> </div> <h3>Returns</h3> <div class="subelement response"> <code>string</code>The requested action</div> </div></div> </div> <h3> <i class="icon-custom icon-property"></i> Properties</h3> <a name="%24_defaultResponseType" id="$_defaultResponseType"> </a><div class="element clickable property protected $_defaultResponseType" data-toggle="collapse" data-target=".$_defaultResponseType .collapse"> <h2>The default response type, if it's not modified based on input.</h2> <pre>$_defaultResponseType : string</pre> <div class="labels"></div> <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div> </div> <a name="%24_routePathIfEmpty" id="$_routePathIfEmpty"> </a><div class="element clickable property protected $_routePathIfEmpty" data-toggle="collapse" data-target=".$_routePathIfEmpty .collapse"> <h2>The route path to apply if the path ever becomes empty.</h2> <pre>$_routePathIfEmpty : string</pre> <div class="labels"></div> <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div> </div> <a name="%24_rules" id="$_rules"> </a><div class="element clickable property protected $_rules" data-toggle="collapse" data-target=".$_rules .collapse"> <h2>Stack of rules to match against.</h2> <pre>$_rules : array</pre> <div class="labels"></div> <div class="row collapse"><div class="detail-description"> <p class="long_description"><p>Once a match is found, further matching stops.</p></p> <table class="table table-bordered"><tr> <th>see</th> <td>\global\addRules()</td> </tr></table> </div></div> </div> </div> </div> </div> </div> <div class="row"><footer class="span12"> Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br> Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a10</a> and<br> generated on 2013-04-30T01:58:28-05:00.<br></footer></div> </div> </body> </html>