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 | 11beca762b31722e0e6690446f6dabf83bf9dafa (patch) | |
| tree | 7271aa4948002c6f57feb6230975d2304d95ddf5 /src | |
| parent | ac836311005458a10dded324420be92f44976332 (diff) | |
code formatting
Diffstat (limited to 'src')
| -rw-r--r-- | src/AbstractStrategy.php | 4 | ||||
| -rw-r--r-- | src/Contracts/Strategy.php | 1 | ||||
| -rw-r--r-- | src/Enums/PathSegmentType.php | 6 | ||||
| -rw-r--r-- | src/PathSegmentTypeMatch.php | 3 | ||||
| -rw-r--r-- | src/Router.php | 1 |
5 files changed, 8 insertions, 7 deletions
diff --git a/src/AbstractStrategy.php b/src/AbstractStrategy.php index 206fd0d..a68f5c1 100644 --- a/src/AbstractStrategy.php +++ b/src/AbstractStrategy.php @@ -35,9 +35,7 @@ abstract class AbstractStrategy implements Strategy { foreach ($parameters as $key => $value) { if (!is_string($value)) { - throw new InvalidArgumentException( - "Parameter {$key} is not a string." - ); + throw new InvalidArgumentException("Parameter {$key} is not a string."); } } diff --git a/src/Contracts/Strategy.php b/src/Contracts/Strategy.php index bf447c3..afd1c8c 100644 --- a/src/Contracts/Strategy.php +++ b/src/Contracts/Strategy.php @@ -26,6 +26,7 @@ interface Strategy /** * @param array<string, mixed> $parameters + * * @return array<string, string> */ public function parseParameters(array $parameters): array; diff --git a/src/Enums/PathSegmentType.php b/src/Enums/PathSegmentType.php index 7cb1a51..414b945 100644 --- a/src/Enums/PathSegmentType.php +++ b/src/Enums/PathSegmentType.php @@ -26,10 +26,10 @@ enum PathSegmentType $regex = $type->routeMatchRegex(); if (preg_match($regex, $value, $matches) === 1) { $value = $matches[1]; - } - else { + } else { $type = PathSegmentType::Raw; } - return new PathSegmentTypeMatch( $type, $value); + + return new PathSegmentTypeMatch($type, $value); } } diff --git a/src/PathSegmentTypeMatch.php b/src/PathSegmentTypeMatch.php index 4e32bdb..c50e74e 100644 --- a/src/PathSegmentTypeMatch.php +++ b/src/PathSegmentTypeMatch.php @@ -9,5 +9,6 @@ readonly class PathSegmentTypeMatch final public function __construct( public PathSegmentType $type, public string $value, - ) {} + ) { + } } diff --git a/src/Router.php b/src/Router.php index 1c5e087..b219651 100644 --- a/src/Router.php +++ b/src/Router.php @@ -181,6 +181,7 @@ class Router { $route = $this->getNamedRoute($name); $params = $this->strategy->parseParameters($params); + return $route?->getPath($params); } } |
