Update Route.php
This commit is contained in:
parent
b05d48204b
commit
1858cfc1b1
13
Route.php
13
Route.php
@ -1,26 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace WillySoft;
|
||||
namespace App\Http;
|
||||
|
||||
use \Exception;
|
||||
use \InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Minimalistic Web Application Router
|
||||
* Minimalistic Web Application Router
|
||||
*/
|
||||
abstract class Route
|
||||
{
|
||||
static string $prefix = '';
|
||||
|
||||
static array $groups = [ [ ] ];
|
||||
static array $groups = [ [ ] ];
|
||||
|
||||
static function getRelativeRequestPath(): string
|
||||
{
|
||||
static $request_url_path;
|
||||
|
||||
if (isset($request_url_path)) {
|
||||
if (isset($request_url_path))
|
||||
return $request_url_path;
|
||||
}
|
||||
|
||||
$request_url_path = substr_replace(
|
||||
urldecode(strtok($_SERVER['REQUEST_URI'], '?')), '', 0, strlen($_SERVER['SCRIPT_NAME'])
|
||||
@ -56,8 +54,7 @@ abstract class Route
|
||||
if ($url_path_parts[$i][-1] === '?'
|
||||
&& $i !== (count($url_path_parts) - 1)
|
||||
) throw new Exception(
|
||||
'Only the last route parameter is allowed to be optional.'
|
||||
);
|
||||
'Only the last route parameter is allowed to be optional.');
|
||||
|
||||
if ($request_url_path_parts[$i] !== '')
|
||||
array_push(
|
||||
|
Loading…
x
Reference in New Issue
Block a user