public function getPath(): string
    {
        if (\count($this->segments) === 0) {
            return '/';
        }

        $path = sprintf('/%s/', implode('/', $this->segments));

        if (!$this->definition->hasSlash()) {
            $path = substr($path, 0, -1);
        }

        return $path;
    }