summaryrefslogtreecommitdiff
path: root/src/PathSegment.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/PathSegment.php')
-rw-r--r--src/PathSegment.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/PathSegment.php b/src/PathSegment.php
index c2231da..d55102f 100644
--- a/src/PathSegment.php
+++ b/src/PathSegment.php
@@ -162,10 +162,16 @@ class PathSegment
return $seg;
}
- public function getPath(): string
+ /** @param array<string, string> $parameters */
+ public function getPath(array $parameters = []): string
{
$parts = array_map(
- fn ($seg) => $seg->getContent(),
+ fn ($seg) => match ($seg->getType()) {
+ PathSegmentType::Parameter => (
+ $parameters[$v = ($seg->getValue() ?? '')] ?? throw MissingParameterException::make($v)
+ ),
+ default => $seg->getContent(),
+ },
$this->getAncestorsAndSelf()
);