Test empty var

This commit is contained in:
Knah Tsaeb 2024-12-03 16:57:27 +01:00
parent 2aa3bce5f7
commit 2ab152e158

View file

@ -32,10 +32,13 @@ class Router {
* @return array|false Returns an array containing the target and parameters
*/
public function match(array $config): array|false {
$extraParams = [];
$requestMethod = $_SERVER['REQUEST_METHOD'];
$this->requestUrl = $requestUrl = strtok($_SERVER['REQUEST_URI'], '?');
if (!empty(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY))) {
parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $extraParams);
}
foreach ($this->routes as $route) {
list($method, $url, $target) = $route;