Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add signature + doc block for new method.
  • Loading branch information
markstory committed Jul 4, 2012
1 parent 31229dd commit c33ea51
Showing 1 changed file with 41 additions and 7 deletions.
48 changes: 41 additions & 7 deletions lib/Cake/Routing/Router.php
Expand Up @@ -97,13 +97,6 @@ class Router {
'UUID' => Router::UUID
);

/**
* The route matching the URL of the current request
*
* @var array
*/
protected static $_currentRoute = array();

/**
* Default HTTP request method => controller action map.
*
Expand Down Expand Up @@ -142,6 +135,14 @@ class Router {
*/
protected static $_initialState = array();

/**
* The stack of URL processors to apply against routing urls before passing the
* parameters to the route collection.
*
* @var array
*/
protected static $_urlProcessors = array();

/**
* Default route class to use
*
Expand Down Expand Up @@ -568,6 +569,39 @@ public static function promote($which = null) {
return static::$_routes->promote($which);
}

/**
* Add a processor to Router.
*
* Processor functions are applied to every array $url provided to
* Router::url() before the urls are sent to the route collection.
*
* Callback functions should expect the following parameters:
*
* - `$params` The url params being processed.
* - `$request` The current request.
*
* The processor function should *always* return the params even if unmodified.
*
* ### Usage
*
* Processors allow you to easily implement features like persistent parameters.
*
* {{{
* Router::addProcessor(function ($params, $request) {
* if (isset($request->params['lang']) && !isset($params['lang']) {
* $params['lang'] = $request->params['lang'];
* }
* return $params;
* });
* }}}
*
* @param callable $function The function to add
* @return void
*/
public static addProcessor($function) {

}

/**
* Finds URL for specified action.
*
Expand Down

0 comments on commit c33ea51

Please sign in to comment.