XBRL.php
private static function get_schema_root( $file )
	{
		if ( filter_var( $file, FILTER_VALIDATE_URL ) === false )
		{
			// my else codes goes
			if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' )
			{
				// First case is c:\
				if ( strlen( $file ) > 1 && substr( $file, 1, 1 ) === ":" )
					$root = "{$file[0]}:";
				// Second case is a volume
				elseif ( strlen( $file ) > 1 && substr( $file, 0, 2 ) === "\\\\" )
				{
					$pos = strpos( $file, '\\', 2 );

					if ( $pos === false )
						$root = $file;
					else
						$root = substr( $file, 0, $pos );
				}
				// The catch all is that no root is provided
				else
					$root = pathinfo( $file, PATHINFO_EXTENSION ) === ""
						? $file
						: pathinfo( $file, PATHINFO_DIRNAME );
			}
		}
		else
		{
			$components = parse_url( $file );
			$root = "{$components['scheme']}://{$components['host']}";
		}

		return $root;
	}
private static function get_schema_root( $file )
	{
		if ( filter_var( $file, FILTER_VALIDATE_URL ) === false )
		{
			// my else codes goes
			if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' )
			{
				// First case is c:\
				if ( strlen( $file ) > 1 && substr( $file, 1, 1 ) === ":" )
					$root = "{$file[0]}:";
				// Second case is a volume
				elseif ( strlen( $file ) > 1 && substr( $file, 0, 2 ) === "\\\\" )
				{
					$pos = strpos( $file, '\\', 2 );

					if ( $pos === false )
						$root = $file;
					else
						$root = substr( $file, 0, $pos );
				}
				// The catch all is that no root is provided
				else
					$root = pathinfo( $file, PATHINFO_EXTENSION ) === ""
						? $file
						: pathinfo( $file, PATHINFO_DIRNAME );
			}
		}
		else
		{
			$components = parse_url( $file );
			$root = "{$components['scheme']}://{$components['host']}";
		}

		return $root;
	}
private static function get_schema_root ( $ file ) { if ( filter_var ( $ file , FILTER_VALIDATE_URL ) === false ) { // my else codes goes
 if ( strtoupper ( substr ( PHP_OS , 0 , 3 ) ) === 'WIN' ) { // First case is c:\
 if ( strlen ( $ file ) > 1 && substr ( $ file , 1 , 1 ) === ":" ) $ root = "{$file[0]}:" ; // Second case is a volume
 elseif ( strlen ( $ file ) > 1 && substr ( $ file , 0 , 2 ) === "\\\\" ) { $ pos = strpos ( $ file , '\\' , 2 ) ; if ( $ pos === false ) $ root = $ file ; else $ root = substr ( $ file , 0 , $ pos ) ; } // The catch all is that no root is provided
 else $ root = pathinfo ( $ file , PATHINFO_EXTENSION ) === "" ? $ file : pathinfo ( $ file , PATHINFO_DIRNAME ) ; } } else { $ components = parse_url ( $ file ) ; $ root = "{$components['scheme']}://{$components['host']}" ; } return $ root ; }
Used by resolve_path to obtain the root element of a uri or file path.
This is necessary because a schema or linkbase uri may be absolute but without a host.

@param string The file
@return string The root
Used by resolve_path to obtain the root element of a uri or file path . This is necessary because a schema or linkbase uri may be absolute but without a host .