diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
index b285d9d..02facb2 100644
--- a/.idea/php.xml
+++ b/.idea/php.xml
@@ -35,13 +35,13 @@
-
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b49c99b..c262aba 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,12 +5,12 @@
+
+
-
-
-
+
-
+
@@ -21,64 +21,46 @@
$PROJECT_DIR$/composer.json
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -86,8 +68,8 @@
-
-
+
+
@@ -96,58 +78,42 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
+
+
-
+
-
-
-
-
-
+
+
@@ -156,8 +122,6 @@
- $this->isPro
- 7.2
options
parent::set
parseParameters
@@ -186,6 +150,8 @@
optiona
\/
requirements
+ ler = new I
+ csrf_token
D:\Workspace\simple-php-router\src\Pecee\SimpleRouter\Route
@@ -232,7 +198,6 @@
-
@@ -249,20 +214,19 @@
-
-
-
-
+
+
+
+
+
-
-
false
@@ -270,11 +234,7 @@
false
true
-
- true
- DEFINITION_ORDER
-
-
+
@@ -309,13 +269,13 @@
-
+
@@ -398,7 +358,7 @@
-
+
@@ -457,9 +417,9 @@
+
-
@@ -551,13 +511,12 @@
+
+
-
-
-
@@ -585,9 +544,12 @@
+
+
+
-
+
@@ -602,25 +564,25 @@
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -630,9 +592,6 @@
-
-
-
@@ -790,13 +749,6 @@
-
-
-
-
-
-
-
@@ -806,7 +758,7 @@
-
+
@@ -867,37 +819,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -907,25 +828,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -936,16 +840,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -953,28 +847,93 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Pecee/Http/Middleware/BaseCsrfVerifier.php b/src/Pecee/Http/Middleware/BaseCsrfVerifier.php
index 77c28ba..da1ce3e 100644
--- a/src/Pecee/Http/Middleware/BaseCsrfVerifier.php
+++ b/src/Pecee/Http/Middleware/BaseCsrfVerifier.php
@@ -9,7 +9,7 @@ use Pecee\Http\Security\ITokenProvider;
class BaseCsrfVerifier implements IMiddleware
{
- public const POST_KEY = 'csrf-token';
+ public const POST_KEY = 'csrf_token';
public const HEADER_KEY = 'X-CSRF-TOKEN';
protected $except;
diff --git a/src/Pecee/Http/Request.php b/src/Pecee/Http/Request.php
index cf7cc32..31dc0ae 100644
--- a/src/Pecee/Http/Request.php
+++ b/src/Pecee/Http/Request.php
@@ -84,7 +84,8 @@ class Request
// Check if special IIS header exist, otherwise use default.
$this->setUrl(new Url($this->getHeader('unencoded-url', $this->getHeader('request-uri'))));
-
+
+ $this->method = strtolower($this->getHeader('request-method'));
$this->inputHandler = new InputHandler($this);
$this->method = strtolower($this->inputHandler->value('_method', $this->getHeader('request-method')));
}
@@ -425,4 +426,4 @@ class Request
return $this->data[$name] ?? null;
}
-}
\ No newline at end of file
+}
diff --git a/src/Pecee/SimpleRouter/Route/Route.php b/src/Pecee/SimpleRouter/Route/Route.php
index 8dcc520..08b8622 100644
--- a/src/Pecee/SimpleRouter/Route/Route.php
+++ b/src/Pecee/SimpleRouter/Route/Route.php
@@ -109,6 +109,10 @@ abstract class Route implements IRoute
$router->debug('Loading class %s', $className);
$class = $router->getClassLoader()->loadClass($className);
+ if (\count($controller) === 1) {
+ $controller[1] = '__invoke';
+ }
+
$method = $controller[1];
if (method_exists($class, $method) === false) {
diff --git a/src/Pecee/SimpleRouter/Router.php b/src/Pecee/SimpleRouter/Router.php
index 2d38a31..8d70ebc 100644
--- a/src/Pecee/SimpleRouter/Router.php
+++ b/src/Pecee/SimpleRouter/Router.php
@@ -188,7 +188,7 @@ class Router
$this->routeStack = [];
/* Route any routes added to the stack */
- $this->processRoutes($stack, $route);
+ $this->processRoutes($stack, ($route instanceof IGroupRoute) ? $route : null);
}
}