Compare commits

...

3 Commits

Author SHA1 Message Date
William f778c1f4a2 Mini optimization 2023-01-30 22:18:57 +01:00
William 028908053a FIIXED 2023-01-30 21:29:29 +01:00
William a640b11b66 Uhh make it more readable or sumthin 2023-01-30 17:08:35 +01:00
1 changed files with 8 additions and 7 deletions

View File

@ -12,13 +12,14 @@ abstract class Route {
array_map(strtoupper(...), explode('|', $methods))
)) return;
static $request_path_parts;
if (!isset($request_path_parts)) {
$request_path_parts = explode('/', urldecode(
strtok($_SERVER['REQUEST_URI'], '?')
)
);
static $cache;
if (!isset($cache)) {
$cache = explode('/', urldecode(
strtok($_SERVER['REQUEST_URI'], '?')
));
}
$request_path_parts = $cache;
$path_parts = explode('/', $path);
$callback_args = [];
for ($i=0; $i < count($path_parts); $i++) {
@ -35,7 +36,7 @@ abstract class Route {
return;
}
if (!empty($request_path_parts[$i])) {
$callback_args[] = $request_path_parts[$i];
array_push($callback_args, $request_path_parts[$i]);
}
$request_path_parts[$i] = $path_parts[$i];
}