summaryrefslogtreecommitdiff
path: root/src/PathSegment.php
blob: e57667b9105bbee6311926ffb41733e8840ea0ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
        }
    }
}