Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return part of a string
<?php substr(string $string, int $offset, ?int $length = null): string
<?php foreach ($verbRoutes as &$route) {
if (
isset($route['handler']) && is_string($route['handler'])
&& '__closure__' == substr($route['handler'], 0, 11)
) {
$route['handler'] = unserialize(substr($route['handler'], 11));
}
<?php isset($route['handler']) && is_string($route['handler'])
&& '__closure__' == substr($route['handler'], 0, 11)
) {
$route['handler'] = unserialize(substr($route['handler'], 11));
}
}
}
<?php if (false !== $pos = strpos($path, '?')) {
$path = substr($path, 0, $pos);
}
<?php if (false !== $pos = strpos($path, '&')) {
$path = substr($path, 0, $pos);
}
$path = str_replace('//', '/', $path);
<?php $path = rawurldecode($path);
if (($lengthPath > 0) && substr($path, $lengthPath, 1) == Getter::getDelimiter()) {
$path = substr($path, 0, $lengthPath);
}
<?php if (($lengthPath > 0) && substr($path, $lengthPath, 1) == Getter::getDelimiter()) {
$path = substr($path, 0, $lengthPath);
}
if (substr($path, 0, 1) != Getter::getDelimiter()) {
<?php $path = substr($path, 0, $lengthPath);
}
if (substr($path, 0, 1) != Getter::getDelimiter()) {
$path = Getter::getDelimiter() . $path;
}
<?php {
$prefixLength = strlen($prefix) - 1;
if ($prefixLength > 0 && $prefix[$prefixLength] == self::$delimiter) {
$prefix = $this->removeTrailingDelimiter(substr($prefix, 0, $prefixLength));
}
return $this->removeRootDelimiter($prefix);
<?php private function removeRootDelimiter(string $prefix): string
{
if (substr($prefix, 0, 1) == self::$delimiter) {
return $this->removeRootDelimiter(substr($prefix, 1, strlen($prefix)));
}
<?php private function removeRootDelimiter(string $prefix): string
{
if (substr($prefix, 0, 1) == self::$delimiter) {
return $this->removeRootDelimiter(substr($prefix, 1, strlen($prefix)));
}
return $prefix;
<?php public function onRegister(): RouteInterface
{
if (substr($this->prefix, 0, 1) != Getter::getDelimiter()) {
$this->prefix = Getter::getDelimiter() . $this->prefix;
}