Determine the border between the request path and current route

@param string $path
@param string $route
@return string
970465
private function getBorder($path, $route)
    {
        $border = (strlen($path) > strlen($route))
            ? $path[strlen($route)]
            : '';
        $border = ($route === '/') ? '/' : $border;
        return $border;
    }
942659
public function dispatch($path, RouteRequest $request = null)
    {
        if ($route = $this->match($path)) {
            // When the callback is an integer, it's refereing to a submux object.
            if (is_integer($route[2])) {
                $submux = $this->submux[$route[2]];
                $options = $route[3];

                // sub-path and call submux to dispatch
                // for pcre pattern?
                if ($route[0]) {

                    $matchedString = $route[3]['vars'][0];

                    return $submux->dispatch(substr($path, strlen($matchedString)));

                } else {
                    $s = substr($path, strlen($route[1]));

                    return $submux->dispatch(
                        substr($path, strlen($route[1])) ?: ''
                    );
                }
            }

            return $route;
        }
    }
621957
public function track(Route $route, Request $request)
    {
        return $this->trackRoutePath(
            $route, $request, $this->trackRoute($route)
        );
    }
412227
private function locatePath($path)
    {
        if ($this->isAbsolutePath($path)) {
            return $path;
        }

        return $this->basePath . DIRECTORY_SEPARATOR . $path;
    }
1263065
protected function resolvePath($path)
    {
        $parts = explode('.', $path);
        $settings = $this->settings;
        foreach ($parts as $part) {
            if (!isset($settings[$part])) {
                return null;
            }
        
            $settings = $settings[$part];
        }
        
        return $settings;
    }
344381
public function getRouteOptions($path)
    {
        $routeName = ltrim($path, '/');
        if (!isset($this->routeOptions[$routeName])) {
            return [];
        }
        return $this->routeOptions[$routeName];
    }
711771
protected function matchPathTemplate($template, Route $path)
    {
        $templateParts = explode('!', $template);

        if (count($templateParts) > 1) {
            $domainTemplate = $templateParts[0];
            $basepathTemplate = $templateParts[1];
        } else {
            $domainTemplate = null;
            $basepathTemplate = $templateParts[0];
        }

        if (!empty($domainTemplate)) {
            $domainMatches = $this->getTemplateMatches($domainTemplate, $path->domain);
            if (false === $domainMatches) {
                return false;
            }
        } else {
            $domainMatches = [];
        }
        $basepathMatches = $this->getTemplateMatches($basepathTemplate, $path->basepath);
        if (false === $basepathMatches) {
            return false;
        }

        return $domainMatches + $basepathMatches;
    }
203367
static public function getRoutePatternParts( Route $route ){
		$parts	= array();
		foreach( explode( "/", $route->getPattern() ) as $part ){
			$optional	= FALSE;
			$argument	= FALSE;
			if( preg_match( "@\(:.+\)@", $part ) ){													//  optional argument found
				$part		= substr( $part, 1, -1 );												//  cut argument key
				$optional	= TRUE;																	//  note that is optional
			}
			if( substr( $part, 0, 1 ) === ":" ){													//  argument found
				$part		= substr( $part, 1 );													//  cut argument key
				$argument	= TRUE;																	//  note that is argument
			}
			$parts[]	= (object) array(															//  prepare route pattern part object
				'key'		=> $part,
				'optional'	=> $optional,
				'argument'	=> $argument,
			);
		}
		return $parts;
	}
478129
public static function verify($route, $path, $method=null)
    {
        /*
         * check method comparison, if method is specified.
         */
        $routeMethod = $method;
        if (strpos($route, ':') !== false && substr($route, 0, 1) !== '/' ) {
            list($routeMethod, $route) = explode( ':', $route, 2 );
            $routeMethod = strtolower($routeMethod);
            if ($method === '*') {
                // no matching against method!
            }
            elseif (strcmp(strtolower($method), $routeMethod)) {
                return [];
            }
        }
        $route = '/'.ltrim($route, '/');
        $path  = '/'.ltrim($path, '/');
        /*
         * now verify route against the path.
         */
        // replace {name} => (?P<name>[-_0-9a-zA-Z]+)
        $route = preg_replace_callback(
            '/{([_:*0-9a-zA-Z]+)}/',
            [self::class,'identifier'],
            $route
        );
        if(substr($route, -1) === '*') {
            $route  = substr($route, 0, -1 ) . '(.*)';
        }
        // now match the route against the path.
        if (preg_match('#^'.$route.'$#', $path, $matches)) {
            if(isset($matches['trailing'])) { // with *
                if(!$matches['trailing']) {
                    $matches['matched'] = $matches[0];
                } else {
                    $matches['matched'] = substr($path, 0, -strlen($matches['trailing']));
                }
            }
            $matches['method'] = $routeMethod;
            return $matches;
        }
        return [];
    }
336945
public function matches(Route $route, Request $request)
    {
        $path = $request->path() === '/' ? '/' : '/'.$request->path();

        return preg_match($route->getCompiled()->getRegex(), rawurldecode($path));
    }
1256773
public function extractRoutePath(string $route)
    {
        $url = (strpos($route, '/') === false) ? url($route) : $route;
        $this->router->handle($url);

        return $this->router->getMatchedRoute()->getPaths();
    }
705166
public function getRoute($path = null)
    {
        // check the path
        if (!$path || ($this->path && $path != $this->path)){
            $urlParts = $this->urlPart;
        } else {
            $urlParts = $this->parsePath($path);
        }
        return $this->routeSystem->getRoute($urlParts);
    }
661298
public function getCurrentDepth($path)
    {
        $parts = $this->getMagePathParts($path);
        return $parts !== false ? count($parts) : -1;
    }
1245910
public function determineRequestUriFromPath($path)
    {
        if ($path instanceof Url) {
            $uri = $path;
        } elseif (stripos($path, 'http://') === 0 || stripos($path, 'https://') === 0) {
            $uri = new Url($path);
        } else {
            $path = (string) $path;
            $uri = $this->getBaseApiUri();

            if (false !== strpos($path, '?')) {
                $parts = explode('?', $path, 2);
                $path = $parts[ 0 ];
                $query = $parts[ 1 ];
                $uri->setQuery($query);
            }

            // Add path
            $uri->getPath()->append("$path");

            // Clean up double slashes
            $uri->setPath(array_filter($uri->getPath()->toArray()));
        }

        return $uri;
    }
904030
protected function realpath(string $path): string
    {
        if ($path === '') {
            return $this->baseDir;
        }

        if ($path[0] === '/' || (!empty($path[1]) && $path[1] === ':')) {
            return $path;
        }

        return $this->baseDir . '/' . $path;
    }
841530
private function signatureParameters(Route $route)
    {
        return collect($route->signatureParameters())
            ->reject(function (ReflectionParameter $parameter) use ($route) {
                return !array_key_exists($parameter->name, $route->parameters());
            })
            ->reject(function (ReflectionParameter $parameter) {
                return !$parameter->getClass();
            })->toArray();
    }
1325508
public function baseRoute($route)
    {
        if(strpos($route, '@') === 0) {
            $route = substr($route, 1, strlen($route)-1);
        } else {
            $baseRoute = $this->route->getParentRouteName();
            $route		= $baseRoute ? $baseRoute.'.'.$route : $route;
        }

        return $route;
    }