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 | 7a19b83bf7d7d8a2650356168cdb296b6f82807f (patch) | |
| tree | 81891e5791d18daa8ec34497131fb65615039858 /src | |
| parent | 8c0efd0d9317ad92bd55cd6afcd41bdbab827bf8 (diff) | |
code formatting
Diffstat (limited to 'src')
| -rw-r--r-- | src/Contracts/Strategy.php | 1 | ||||
| -rw-r--r-- | src/RouteCall.php | 3 | ||||
| -rw-r--r-- | src/Router.php | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/Contracts/Strategy.php b/src/Contracts/Strategy.php index 81d6ec3..bb877c1 100644 --- a/src/Contracts/Strategy.php +++ b/src/Contracts/Strategy.php @@ -11,5 +11,6 @@ use Psr\Http\Message\ResponseInterface; interface Strategy { public function runRoute(RouteCall $call): ResponseInterface; + public function notFound(RequestInterface $request): ResponseInterface; } diff --git a/src/RouteCall.php b/src/RouteCall.php index b76a780..c598748 100644 --- a/src/RouteCall.php +++ b/src/RouteCall.php @@ -13,5 +13,6 @@ class RouteCall public RequestInterface $request, public Route $route, public array $parameters, - ) {} + ) { + } } diff --git a/src/Router.php b/src/Router.php index ddd3220..87f7931 100644 --- a/src/Router.php +++ b/src/Router.php @@ -7,8 +7,6 @@ namespace Lightscale\Router; use Lightscale\Router\Contracts\Strategy; use Lightscale\Router\Enums\HttpMethod; use Lightscale\Router\Enums\PathSegmentType; -use Lightscale\Router\Exceptions\NotFoundException; -use Lightscale\Router\Exceptions\UnknownMethodException; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -20,7 +18,7 @@ class Router public function __construct() { $this->root = new PathSegment(type: PathSegmentType::Root); - $this->strategy = new BasicStrategy; + $this->strategy = new BasicStrategy(); } public function getStrategy(): Strategy @@ -80,7 +78,7 @@ class Router $method = $request->getMethod(); $method = HttpMethod::tryFrom(strtolower($method)); - if ($method === null) { + if (null === $method) { return $this->strategy->notFound($request); } @@ -104,7 +102,7 @@ class Router $pathSplit = $this->splitPath($path); $seg = $this->root(); - while(($v = array_shift($pathSplit)) !== null) { + while (($v = array_shift($pathSplit)) !== null) { $seg = $seg->child($v); } |
