mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Code formatting cleanup. Fixes #92.
This commit is contained in:
parent
b273981915
commit
d550a5e82c
1 changed files with 31 additions and 9 deletions
|
@ -1146,44 +1146,56 @@ class Router {
|
||||||
* @see Router::connect
|
* @see Router::connect
|
||||||
*/
|
*/
|
||||||
class CakeRoute {
|
class CakeRoute {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of named segments in a Route.
|
* An array of named segments in a Route.
|
||||||
* `/:controller/:action/:id` has 3 named elements
|
* `/:controller/:action/:id` has 3 named elements
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
* @access public
|
||||||
|
*/
|
||||||
var $keys = array();
|
var $keys = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of additional parameters for the Route.
|
* An array of additional parameters for the Route.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
* @access public
|
||||||
|
*/
|
||||||
var $options = array();
|
var $options = array();
|
||||||
/**
|
/**
|
||||||
* Default parameters for a Route
|
* Default parameters for a Route
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $defaults = array();
|
var $defaults = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The routes template string.
|
* The routes template string.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
* @access public
|
||||||
|
*/
|
||||||
var $template = null;
|
var $template = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this route a greedy route? Greedy routes have a `/*` in their
|
* Is this route a greedy route? Greedy routes have a `/*` in their
|
||||||
* template
|
* template
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
* @access protected
|
||||||
|
*/
|
||||||
var $_greedy = false;
|
var $_greedy = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The compiled route regular expresssion
|
* The compiled route regular expresssion
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
* @access protected
|
||||||
|
*/
|
||||||
var $_compiledRoute = null;
|
var $_compiledRoute = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP header shortcut map. Used for evaluating header-based route expressions.
|
* HTTP header shortcut map. Used for evaluating header-based route expressions.
|
||||||
*
|
*
|
||||||
|
@ -1195,6 +1207,7 @@ class CakeRoute {
|
||||||
'method' => 'request_method',
|
'method' => 'request_method',
|
||||||
'server' => 'server_name'
|
'server' => 'server_name'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a Route
|
* Constructor for a Route
|
||||||
*
|
*
|
||||||
|
@ -1202,20 +1215,24 @@ class CakeRoute {
|
||||||
* @param array $defaults Array of defaults for the route.
|
* @param array $defaults Array of defaults for the route.
|
||||||
* @param string $params Array of parameters and additional options for the Route
|
* @param string $params Array of parameters and additional options for the Route
|
||||||
* @return void
|
* @return void
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
function CakeRoute($template, $defaults = array(), $options = array()) {
|
function CakeRoute($template, $defaults = array(), $options = array()) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
$this->defaults = (array)$defaults;
|
$this->defaults = (array)$defaults;
|
||||||
$this->options = (array)$options;
|
$this->options = (array)$options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a Route has been compiled into a regular expression.
|
* Check if a Route has been compiled into a regular expression.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
**/
|
* @access public
|
||||||
|
*/
|
||||||
function compiled() {
|
function compiled() {
|
||||||
return !empty($this->_compiledRoute);
|
return !empty($this->_compiledRoute);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiles the routes regular expression. Modifies defaults property so all necessary keys are set
|
* Compiles the routes regular expression. Modifies defaults property so all necessary keys are set
|
||||||
* and populates $this->names with the named routing elements.
|
* and populates $this->names with the named routing elements.
|
||||||
|
@ -1230,6 +1247,7 @@ class CakeRoute {
|
||||||
$this->_writeRoute();
|
$this->_writeRoute();
|
||||||
return $this->_compiledRoute;
|
return $this->_compiledRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a route regular expression. Uses the template, defaults and options
|
* Builds a route regular expression. Uses the template, defaults and options
|
||||||
* properties to compile a regular expression that can be used to match/parse request strings.
|
* properties to compile a regular expression that can be used to match/parse request strings.
|
||||||
|
@ -1284,6 +1302,7 @@ class CakeRoute {
|
||||||
*
|
*
|
||||||
* @param string $url The url to attempt to parse.
|
* @param string $url The url to attempt to parse.
|
||||||
* @return mixed Boolean false on failure, otherwise an array or parameters
|
* @return mixed Boolean false on failure, otherwise an array or parameters
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
function parse($url) {
|
function parse($url) {
|
||||||
if (!$this->compiled()) {
|
if (!$this->compiled()) {
|
||||||
|
@ -1338,6 +1357,7 @@ class CakeRoute {
|
||||||
* @param array $url The array to apply persistent parameters to.
|
* @param array $url The array to apply persistent parameters to.
|
||||||
* @param array $params An array of persistent values to replace persistent ones.
|
* @param array $params An array of persistent values to replace persistent ones.
|
||||||
* @return array An array with persistent parameters applied.
|
* @return array An array with persistent parameters applied.
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
function persistParams($url, $params) {
|
function persistParams($url, $params) {
|
||||||
foreach ($this->options['persist'] as $persistKey) {
|
foreach ($this->options['persist'] as $persistKey) {
|
||||||
|
@ -1355,7 +1375,8 @@ class CakeRoute {
|
||||||
*
|
*
|
||||||
* @param array $url An array of parameters to check matching with.
|
* @param array $url An array of parameters to check matching with.
|
||||||
* @return mixed Either a string url for the parameters if they match or false.
|
* @return mixed Either a string url for the parameters if they match or false.
|
||||||
**/
|
* @access public
|
||||||
|
*/
|
||||||
function match($url) {
|
function match($url) {
|
||||||
if (!$this->compiled()) {
|
if (!$this->compiled()) {
|
||||||
$this->compile();
|
$this->compile();
|
||||||
|
@ -1428,13 +1449,14 @@ class CakeRoute {
|
||||||
}
|
}
|
||||||
return $this->_writeUrl(array_merge($url, compact('pass', 'named')));
|
return $this->_writeUrl(array_merge($url, compact('pass', 'named')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a matching route array into a url string.
|
* Converts a matching route array into a url string.
|
||||||
*
|
*
|
||||||
* @params array $params The params to convert to a string url.
|
* @param array $params The params to convert to a string url.
|
||||||
* @return string Compiled route string.
|
* @return string Compiled route string.
|
||||||
* @access protected
|
* @access protected
|
||||||
**/
|
*/
|
||||||
function _writeUrl($params) {
|
function _writeUrl($params) {
|
||||||
if (isset($params['plugin'], $params['controller']) && $params['plugin'] === $params['controller']) {
|
if (isset($params['plugin'], $params['controller']) && $params['plugin'] === $params['controller']) {
|
||||||
unset($params['controller']);
|
unset($params['controller']);
|
||||||
|
|
Loading…
Add table
Reference in a new issue