19declare(strict_types=1);
23use Psr\Http\Message\ServerRequestInterface;
37 private ServerRequestInterface $request
39 $this->endpoint =
'/' . trim($this->config->getEndpoint() .
'/',
'/');
44 $path = $this->request->getUri()->getPath();
46 $requested_path = ltrim(substr(
$path, strpos(
$path, $this->endpoint) + strlen($this->endpoint)),
'/');
52 $segments = explode(
'/', $requested_path, 2);
54 return $segments[1] ??
'';
58 return $requested_path;
63 $path = $this->request->getUri()->getPath();
64 $end = strpos(
$path, $this->endpoint);
66 return rtrim($this->endpoint,
'/') .
'/';
68 $base = substr(
$path, 0, $end) . $this->endpoint .
'/';
75 $remainder = ltrim(substr(
$path, $end + strlen($this->endpoint)),
'/');
76 $first_segment = explode(
'/', $remainder, 2)[0] ??
'';
87 return explode(
'/',
$path);
92 return array_key_exists($this->config->getMountInstructionsQuery(), $this->request->getQueryParams());
98 $_POST = (array) $this->post;
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
__construct(private Config $config, private ServerRequestInterface $request)
getRequestedPathAsArray()
SuperGlobalDropInReplacement array $post