Permalink
Browse files

Renaming RouterRouter::$params to $options.

  • Loading branch information...
1 parent 728613a commit 494875cca2a1c7165578401ed182e13cc189dd12 @markstory markstory committed Dec 2, 2009
Showing with 11 additions and 11 deletions.
  1. +9 −9 cake/libs/router.php
  2. +2 −2 cake/tests/cases/libs/router.test.php
View
@@ -436,7 +436,7 @@ function parse($url) {
if (($r = $route->parse($url)) !== false) {
$self->__currentRoute[] =& $route;
- $params = $route->params;
+ $params = $route->options;
$argOptions = array();
if (array_key_exists('named', $params)) {
@@ -762,7 +762,7 @@ function url($url = null, $full = false) {
for ($i = 0, $len = count($self->routes); $i < $len; $i++) {
$originalUrl = $url;
- if (isset($self->routes[$i]->params['persist'], $params)) {
+ if (isset($self->routes[$i]->options['persist'], $params)) {
$url = $self->routes[$i]->persistParams($url, $params);
}
@@ -1150,7 +1150,7 @@ class RouterRoute {
*
* @var array
**/
- var $params = array();
+ var $options = array();
/**
* Default parameters for a Route
*
@@ -1195,10 +1195,10 @@ class RouterRoute {
* @param string $params Array of parameters and additional options for the Route
* @return void
*/
- function RouterRoute($template, $defaults = array(), $params = array()) {
+ function RouterRoute($template, $defaults = array(), $options = array()) {
$this->template = $template;
$this->defaults = (array)$defaults;
- $this->params = (array)$params;
+ $this->options = (array)$options;
}
/**
* Check if a Route has been compiled into a regular expression.
@@ -1219,7 +1219,7 @@ function compile() {
if ($this->compiled()) {
return $this->_compiledRoute;
}
- $this->_writeRoute($this->template, $this->defaults, $this->params);
+ $this->_writeRoute($this->template, $this->defaults, $this->options);
return $this->_compiledRoute;
}
/**
@@ -1334,7 +1334,7 @@ function parse($url) {
* @return array An array with persistent parameters applied.
*/
function persistParams($url, $params) {
- foreach ($this->params['persist'] as $persistKey) {
+ foreach ($this->options['persist'] as $persistKey) {
if (array_key_exists($persistKey, $params)) {
$url[$persistKey] = $params[$persistKey];
}
@@ -1421,8 +1421,8 @@ function match($url) {
}
//check patterns for routed params
- if (!empty($this->params)) {
- foreach ($this->params as $key => $pattern) {
+ if (!empty($this->options)) {
+ foreach ($this->options as $key => $pattern) {
if (array_key_exists($key, $url) && !preg_match('#^' . $pattern . '$#', $url[$key])) {
return false;
}
@@ -1986,7 +1986,7 @@ function testConstruction() {
$this->assertEqual($route->template, '/:controller/:action/:id');
$this->assertEqual($route->defaults, array());
- $this->assertEqual($route->params, array('id' => '[0-9]+'));
+ $this->assertEqual($route->options, array('id' => '[0-9]+'));
$this->assertFalse($route->compiled());
}
@@ -2133,7 +2133,7 @@ function testComplexRouteCompilingAndParsing() {
$this->assertPattern($result, '/some_extra/page/this_is_the_slug');
$this->assertPattern($result, '/page/this_is_the_slug');
$this->assertEqual($route->keys, array('extra', 'slug'));
- $this->assertEqual($route->params, array('extra' => '[a-z1-9_]*', 'slug' => '[a-z1-9_]+', 'action' => 'view'));
+ $this->assertEqual($route->options, array('extra' => '[a-z1-9_]*', 'slug' => '[a-z1-9_]+', 'action' => 'view'));
$expected = array(
'controller' => 'pages',
'action' => 'view',

0 comments on commit 494875c

Please sign in to comment.