mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Changing interactions inside Router so it doesn't need a CakeRequest object, makes changes to Router test not necessary.
This commit is contained in:
parent
12cbf3198a
commit
bd1365f8ae
2 changed files with 6 additions and 11 deletions
|
@ -242,10 +242,11 @@ class Dispatcher extends Object {
|
|||
extract($namedExpressions);
|
||||
include CONFIGS . 'routes.php';
|
||||
|
||||
$request = Router::parse($request);
|
||||
$params = Router::parse($request->url);
|
||||
$request->addParams($params);
|
||||
|
||||
if (!empty($additionalParams)) {
|
||||
$request->params = array_merge($request->params, $additionalParams);
|
||||
$request->addParams($additionalParams);
|
||||
}
|
||||
return $request;
|
||||
}
|
||||
|
|
|
@ -414,13 +414,12 @@ class Router {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parses given URL and returns an array of controller, action and parameters
|
||||
* taken from that URL.
|
||||
* Parses given URL string. Returns 'routing' parametets for that url.
|
||||
*
|
||||
* @param string $url URL to be parsed
|
||||
* @return array Parsed elements from URL
|
||||
*/
|
||||
public static function parse($request) {
|
||||
public static function parse($url) {
|
||||
|
||||
$self =& Router::getInstance();
|
||||
if (!$self->__defaultsMapped && $self->__connectDefaults) {
|
||||
|
@ -433,9 +432,6 @@ class Router {
|
|||
|
||||
$r = $ext = null;
|
||||
|
||||
// add a leading / and split out the query string.
|
||||
// seems like this could be done in CakeRequest
|
||||
$url = $request->url;
|
||||
if ($url && strpos($url, '/') !== 0) {
|
||||
$url = '/' . $url;
|
||||
}
|
||||
|
@ -487,9 +483,7 @@ class Router {
|
|||
if (!empty($ext) && !isset($out['url']['ext'])) {
|
||||
$out['url']['ext'] = $ext;
|
||||
}
|
||||
|
||||
$request->addParams($out);
|
||||
return $request;
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue