summaryrefslogtreecommitdiff
path: root/src/PathSegment.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/PathSegment.php')
-rw-r--r--src/PathSegment.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/PathSegment.php b/src/PathSegment.php
new file mode 100644
index 0000000..e57667b
--- /dev/null
+++ b/src/PathSegment.php
@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Lightscale\Router;
+
+use Lightscale\Router\Enums\SpecialSegment;
+
+class PathSegment
+{
+ protected string $content;
+
+ protected ?SpecialSegment $specialSegment = null;
+
+ /** @var array<string, static> */
+ protected array $segments;
+
+ public function __construct(
+ SpecialSegment|string $content,
+ ) {
+ if ($content instanceof SpecialSegment) {
+ $this->content = $content->value;
+ $this->specialSegment = $content;
+ } else {
+ $this->content = $content;
+ }
+ }
+}