diff options
| author | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
|---|---|---|
| committer | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
| commit | 8c0efd0d9317ad92bd55cd6afcd41bdbab827bf8 (patch) | |
| tree | c654456753e90ab38b7bcb89ece3381ad7a40f4a /src/BasicStrategy.php | |
| parent | 5fe7c87967ff29c4a8f03a9186918d8359f4887e (diff) | |
Make basic routing work
Diffstat (limited to 'src/BasicStrategy.php')
| -rw-r--r-- | src/BasicStrategy.php | 23 |
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(); + } +} |
