public function isInternalUri(string $uri): bool
    {
        // Replace the scheme if it exists
        $uri = str_replace(['http://', 'https://'], '', $uri);

        // Get the host of the uri
        $host = (string) substr($uri, 0, strpos($uri, '/'));

        // If the host does not match the current request uri's host
        if ($host && $host !== $this->app->request()->getHttpHost()) {
            // Return false immediately
            return false;
        }

        // Get only the path (full string from the first slash to the end
        // of the path)
        $uri = (string) substr($uri, strpos($uri, '/'), \count($uri));

        // Try to match the route
        $route = $this->matchRoute($uri);

        return $route instanceof Route;
    }
public function isInternalUri(string $uri): bool
    {
        // Replace the scheme if it exists
        $uri = str_replace(['http://', 'https://'], '', $uri);

        // Get the host of the uri
        $host = (string) substr($uri, 0, strpos($uri, '/'));

        // If the host does not match the current request uri's host
        if ($host && $host !== $this->app->request()->getHttpHost()) {
            // Return false immediately
            return false;
        }

        // Get only the path (full string from the first slash to the end
        // of the path)
        $uri = (string) substr($uri, strpos($uri, '/'), \count($uri));

        // Try to match the route
        $route = $this->matchRoute($uri);

        return $route instanceof Route;
    }
public function isInternalUri ( string $ uri ) : bool { // Replace the scheme if it exists $ uri = str_replace ( [ 'http://' , 'https://' ] , '' , $ uri ) ; // Get the host of the uri $ host = ( string ) substr ( $ uri , 0 , strpos ( $ uri , '/' ) ) ; // If the host does not match the current request uri's host if ( $ host && $ host !== $ this -> app -> request ( ) -> getHttpHost ( ) ) { // Return false immediately return false ; } // Get only the path (full string from the first slash to the end // of the path) $ uri = ( string ) substr ( $ uri , strpos ( $ uri , '/' ) , \ count ( $ uri ) ) ; // Try to match the route $ route = $ this -> matchRoute ( $ uri ) ; return $ route instanceof Route ; }
Determine if a uri is valid.

@param string $uri The uri to check

@throws \InvalidArgumentException

@return bool
Determine if a uri is valid .