Compare commits

..

No commits in common. "8df2e648728d56124cd095978d6636e7ad441a96" and "014a5480967c03c00dda5ee34c7eaf4be224b96e" have entirely different histories.

3 changed files with 5 additions and 6 deletions

View File

@ -19,7 +19,7 @@ class Redirect implements IRedirect
if (preg_match('/^http(s)?/', $this->target) === 1) { if (preg_match('/^http(s)?/', $this->target) === 1) {
$link = $this->target; $link = $this->target;
} else { } else {
$link = \Container::$request->getBase() . $this->target; $link = \Container::$request->getBase() . '/' . $this->target;
} }
return $link; return $link;

View File

@ -53,7 +53,7 @@ class Route
$query = count($queryParams) > 0 ? '?' . http_build_query($queryParams) : ''; $query = count($queryParams) > 0 ? '?' . http_build_query($queryParams) : '';
return '/' . implode('/', $link) . $query; return implode('/', $link) . $query;
} }
public function testAgainst(array $path): ?array public function testAgainst(array $path): ?array

View File

@ -41,10 +41,9 @@ class RouteCollection
return $this->routes[$id]; return $this->routes[$id];
} }
public function match(string $method, string $uri): ?array public function match(string $method, array $uri): ?array
{ {
$path = $uri === '/' ? [] : explode('/', ltrim($uri, '/')); $groupNumber = count($uri);
$groupNumber = count($path);
// response to HEAD request with the GET content // response to HEAD request with the GET content
if ($method === 'head') { if ($method === 'head') {
@ -56,7 +55,7 @@ class RouteCollection
} }
foreach ($this->searchTable[$method][$groupNumber] as $route) { foreach ($this->searchTable[$method][$groupNumber] as $route) {
if (($parameters = $route->testAgainst($path)) !== null) { if (($parameters = $route->testAgainst($uri)) !== null) {
return [$route, $parameters]; return [$route, $parameters];
} }
} }