applyRules() public static method

Attempts to apply a set of formatting rules from $_rules to a $params array, where each formatting rule is applied if the key of the rule in $_rules is present and not empty in $params. Also performs sanity checking against $params to ensure that no value matching a rule is present unless the rule check passes.
public static applyRules ( array &$params ) : array
$params array An array of route parameters to which rules will be applied.
return array Returns the `$params` array with formatting rules applied to array values.
Esempio n. 1
0
 public function testApplyRulesNamespacingCollision()
 {
     $params = array('library' => 'li3_one', 'controller' => 'li3_two.test', 'action' => 'test');
     $expected = array('library' => 'li3_one', 'controller' => 'li3_two.Test', 'action' => 'test');
     $this->assertEqual($expected, Dispatcher::applyRules($params));
     $params = array('library' => 'li3_one', 'controller' => 'li3_two\\Test', 'action' => 'test');
     $expected = array('library' => 'li3_one', 'controller' => 'li3_two\\Test', 'action' => 'test');
     $this->assertEqual($expected, Dispatcher::applyRules($params));
 }