lithium\action\Dispatcher::$_rules

protected static property

Contains pre-process format strings for changing Dispatcher's behavior based on 'rules'.

Each key in the array represents a 'rule'; if a key that matches the rule is present (and not empty) in a route, (i.e. the result of Router::parse()) then the rule's value will be applied to the route before it is dispatched. When applying a rule, any array elements of the flag which are present in the route will be modified using a Text::insert()-formatted string. Alternatively, a callback can be used to do custom transformations other than the default Text::insert().

For example, to implement action prefixes (i.e. admin_index), set a rule named 'admin', with a value array containing a modifier key for the action element of a route, i.e.: array('action' => 'admin_{:action}'). Now, if the 'admin' key is present and not empty in the parameters returned from routing, the value of 'action' will be rewritten per the settings in the rule:

Dispatcher::config([
	'rules' => [
		'admin' => 'admin_{:action}'
	]
]);

The following example shows two rules that continuously or independently transform the action parameter in order to allow any variations i.e. 'admin_index', 'api_index' and 'admin_api_index'.

// ...
		'api' => 'api_{:action}',
		'admin' => 'admin_{:action}'
// ...

Here's another example. To support normalizing actions, set a rule named 'action' with a value array containing a callback that uses Inflector to camelize the action:

// ...
		'action' => ['action' => function($params) {
			return Inflector::camelize(strtolower($params['action']), false);
		}]
// ...

The entires rules can become a callback as well:

Dispatcher::config([
	'rules' => function($params) {
		// ...
	}
]);

Source

	protected static $_rules = [];