summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AbstractStrategy.php4
-rw-r--r--src/Contracts/Strategy.php1
-rw-r--r--src/Enums/PathSegmentType.php6
-rw-r--r--src/PathSegmentTypeMatch.php3
-rw-r--r--src/Router.php1
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);
}
}