diff options
Diffstat (limited to 'src/AbstractStrategy.php')
| -rw-r--r-- | src/AbstractStrategy.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/AbstractStrategy.php b/src/AbstractStrategy.php index 29d9651..206fd0d 100644 --- a/src/AbstractStrategy.php +++ b/src/AbstractStrategy.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Lightscale\Router; +use InvalidArgumentException; use Lightscale\Router\Contracts\Middleware; use Lightscale\Router\Contracts\Strategy; use Psr\Http\Message\RequestInterface; @@ -29,4 +30,17 @@ abstract class AbstractStrategy implements Strategy return $handler($request); } + + public function parseParameters(array $parameters): array + { + foreach ($parameters as $key => $value) { + if (!is_string($value)) { + throw new InvalidArgumentException( + "Parameter {$key} is not a string." + ); + } + } + + return $parameters; + } } |
