diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b9997c7..b49c99b 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,8 +6,11 @@
+
+
+
-
+
@@ -23,27 +26,36 @@
-
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
@@ -52,11 +64,11 @@
-
+
-
+
@@ -65,17 +77,17 @@
-
+
-
+
-
-
+
+
@@ -83,11 +95,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- addRoute
$this->isPro
7.2
options
@@ -117,6 +185,7 @@
debugEnabled
optiona
\/
+ requirements
D:\Workspace\simple-php-router\src\Pecee\SimpleRouter\Route
@@ -145,7 +214,6 @@
-
@@ -162,7 +230,6 @@
-
@@ -175,7 +242,6 @@
-
@@ -184,11 +250,14 @@
-
+
+
+
+
@@ -246,6 +315,7 @@
+
@@ -261,6 +331,7 @@
+
@@ -323,7 +394,6 @@
-
@@ -480,19 +550,11 @@
+
-
-
-
-
-
-
-
-
-
@@ -514,9 +576,18 @@
+
+
+
+
+
+
+
+
+
-
+
@@ -531,12 +602,12 @@
-
+
-
+
@@ -546,10 +617,10 @@
-
+
-
+
@@ -637,13 +708,6 @@
-
-
-
-
-
-
-
@@ -796,16 +860,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -813,16 +867,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -833,16 +877,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -873,27 +907,74 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 79372f6..e5f4f93 100644
--- a/README.md
+++ b/README.md
@@ -144,6 +144,7 @@ You can find the demo-project here: [https://github.com/skipperbent/simple-route
## Requirements
- PHP 7.1 or greater (version 3.x and below supports PHP 5.5+)
+- PHP JSON extension enabled.
## Features
diff --git a/composer.json b/composer.json
index d0af205..5d285cd 100644
--- a/composer.json
+++ b/composer.json
@@ -28,6 +28,7 @@
],
"require": {
"php": ">=7.1",
+ "ext-json": "*",
"php-di/php-di": "^6.0"
},
"require-dev": {
diff --git a/src/Pecee/Http/Security/CookieTokenProvider.php b/src/Pecee/Http/Security/CookieTokenProvider.php
index b871b35..cb6da8f 100644
--- a/src/Pecee/Http/Security/CookieTokenProvider.php
+++ b/src/Pecee/Http/Security/CookieTokenProvider.php
@@ -63,7 +63,7 @@ class CookieTokenProvider implements ITokenProvider
public function setToken(string $token): void
{
$this->token = $token;
- setcookie(static::CSRF_KEY, $token, (int)((time() + 60) * $this->cookieTimeoutMinutes), '/', ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly'));
+ setcookie(static::CSRF_KEY, $token, (time() + 60) * $this->cookieTimeoutMinutes, '/', ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly'));
}
/**
diff --git a/src/Pecee/SimpleRouter/Route/Route.php b/src/Pecee/SimpleRouter/Route/Route.php
index f04800a..8dcc520 100644
--- a/src/Pecee/SimpleRouter/Route/Route.php
+++ b/src/Pecee/SimpleRouter/Route/Route.php
@@ -151,12 +151,10 @@ abstract class Route implements IRoute
/* If custom regex is defined, use that */
if (isset($this->where[$name]) === true) {
$regex = $this->where[$name];
+ } else if ($parameterRegex !== null) {
+ $regex = $parameterRegex;
} else {
- if ($parameterRegex !== null) {
- $regex = $parameterRegex;
- } else {
- $regex = $this->defaultParameterRegex ?? static::PARAMETERS_DEFAULT_REGEX;
- }
+ $regex = $this->defaultParameterRegex ?? static::PARAMETERS_DEFAULT_REGEX;
}
$regex = sprintf('((\/|\-)(?P<%2$s>%3$s))%1$s', $parameters[2][$key], $name, $regex);
diff --git a/src/Pecee/SimpleRouter/SimpleRouter.php b/src/Pecee/SimpleRouter/SimpleRouter.php
index 4400118..cd1b61c 100644
--- a/src/Pecee/SimpleRouter/SimpleRouter.php
+++ b/src/Pecee/SimpleRouter/SimpleRouter.php
@@ -261,7 +261,7 @@ class SimpleRouter
* @return RouteGroup
* @throws InvalidArgumentException
*/
- public static function group(array $settings = [], \Closure $callback): IGroupRoute
+ public static function group(array $settings, \Closure $callback): IGroupRoute
{
if (\is_callable($callback) === false) {
throw new InvalidArgumentException('Invalid callback provided. Only functions or methods supported');