summaryrefslogtreecommitdiff
path: root/src/BasicStrategy.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/BasicStrategy.php')
-rw-r--r--src/BasicStrategy.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/BasicStrategy.php b/src/BasicStrategy.php
new file mode 100644
index 0000000..62bc48e
--- /dev/null
+++ b/src/BasicStrategy.php
@@ -0,0 +1,23 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Lightscale\Router;
+
+use Lightscale\Router\Contracts\Strategy;
+use Lightscale\Router\Exceptions\NotFoundException;
+use Psr\Http\Message\RequestInterface;
+use Psr\Http\Message\ResponseInterface;
+
+class BasicStrategy implements Strategy
+{
+ public function runRoute(RouteCall $call): ResponseInterface
+ {
+ return ($call->route->getHandler())($call);
+ }
+
+ public function notFound(RequestInterface $request): ResponseInterface
+ {
+ throw new NotFoundException();
+ }
+}