Returns a localized version of the schema file path
@param string $uri
@return string
352645
protected function getActualUri( $uri )
	{
		// Break the Uri into its parts
		$path = parse_url( $uri, PHP_URL_PATH );
		// Skip the scheme/domain/us-gaap/year/
		$parts = explode( '/', $path );
		array_splice( $parts, 0, 3, $this->getFirstFolderName() );
		return join( '/', $parts );

		return $this->actualSchemaFilename;
	}
991168
public function preProcessURI($uri) {
        $s = preg_replace("/\{([\w]+)\}/", "[*:$1]", $uri);
            
        if (!empty($s)) {
            $uri = $s;
        }
        
        return $uri;
    }
609874
public function getRouteNameFromPath($uri, $locale)
    {
        $attributes = Url::extractAttributes($uri);
        $uri        = str_replace([url('/'), "/$locale/"], '', $uri);
        $uri        = trim($uri, '/');

        foreach ($this->translatedRoutes as $routeName) {
            $url = Url::substituteAttributes($attributes, $this->translate($routeName));

            if ($url === $uri) return $routeName;
        }

        return false;
    }
72350
private function parseUri(string $uri): array
    {
        $defaults = [
            'scheme'   => '',
            'host'     => '',
            'port'     => '',
            'user'     => '',
            'pass'     => '',
            'path'     => '',
            'query'    => '',
            'fragment' => '',
        ];

        if (0 === strpos($uri, 'file://')) {
            // parse_url botches this up
            preg_match('@file://(?P<path>[^#]*)(?P<fragment>#.*)?@', $uri, $matches);

            return array_merge($defaults, array_intersect_key($matches, $defaults));
        }

        return array_merge($defaults, array_intersect_key(parse_url($uri), $defaults));
    }
612357
public function getNamespaceForSchema( $uri )
	{
		$actualUri = $this->getActualUri( $uri );
		$content = $this->getFile( $actualUri );
		if ( ! $content ) return false;

		return $this->getTargetNamespace( $uri, $content );
	}
1311594
private function getPathFromUri($uri)
    {
        $uriParser = new UriParser($uri);
        // Prepare uri
        $uriParser->encode();
        $uri = $uriParser->stripFragment();
        if (strpos($uri, '/') === 0) {
            // URI is already an path
            return $uri;
        }
        if (!$uriParser->validate()) {
            throw new \InvalidArgumentException('Invalid URI');
        }
        $path = (($path = parse_url($uri, PHP_URL_PATH)) === null) ? '/' : $path;
        $query = (($query = parse_url($uri, PHP_URL_QUERY)) === null) ? '' : '?' . $query;
        return $path . $query;
    }
1232066
def uri_to_path(uri)
    return unless uri.is_a?(URI)

    # CGI.unescape doesn't handle space rules properly in uri paths
    # URI.unescape does, but returns strings in their original encoding
    path = URI.unescape(uri.path.encode(Encoding::UTF_8))

    if Puppet::Util::Platform.windows? && uri.scheme == 'file'
      if uri.host
        path = "//#{uri.host}" + path # UNC
      else
        path.sub!(/^\//, '')
      end
    end

    path
  end
1214990
private function toAbsoluteURI($uri)
    {
        list($pathBase, $scheme, $prePath) = $this->getPathInfo($this->configuration->getOriginalURL());

        // If this is already an absolute URI, return it.
        if (preg_match('/^[a-zA-Z][a-zA-Z0-9\+\-\.]*:/', $uri)) {
            return $uri;
        }

        // Scheme-rooted relative URI.
        if (substr($uri, 0, 2) === '//') {
            return $scheme . '://' . substr($uri, 2);
        }

        // Prepath-rooted relative URI.
        if (substr($uri, 0, 1) === '/') {
            return $prePath . $uri;
        }

        // Dotslash relative URI.
        if (strpos($uri, './') === 0) {
            return $pathBase . substr($uri, 2);
        }
        // Ignore hash URIs:
        if (substr($uri, 0, 1) === '#') {
            return $uri;
        }

        // Standard relative URI; add entire path. pathBase already includes a
        // trailing "/".
        return $pathBase . $uri;
    }
925745
public String getPath(String base, String uri) throws ResourceNotFoundException, IOException {

		String fileName = uri;
		if (!fileName.endsWith(".scss")) {
			fileName += ".scss";
		}

		String parentPath = base.replace('\\', '/');
		fileName = fileName.replace('\\', '/');

		return PathNormalizer.concatWebPath(parentPath, fileName);
	}
1154959
public function fileCheck($uri=null) {
        global $TSUGI_REST_PATH_VALUES;
        global $TSUGI_REST_PATH;
        $TSUGI_REST_PATH = false;
        $TSUGI_REST_PATH_VALUES = false;
        if ( $uri === null ) $uri = $_SERVER['REQUEST_URI'];
        $uri = self::trimQuery($uri);
        // /wa4e/tsugi
        $cwd = self::cwd();
	if ( ! endsWith($cwd, '/') ) $cwd = $cwd .'/';
        if ( strpos($uri,$cwd) === 0 ) {
            $remainder = substr($uri, strlen($cwd));
            if ( strlen($remainder) < 1 ) return false;
            $pieces = explode('/',$remainder,2);
            $file = $pieces[0] . '.php';
            if ( file_exists($file) ) {
                $TSUGI_REST_PATH = $cwd . '/' . $pieces[0];
                if ( count($pieces) > 1 ) $TSUGI_REST_PATH_VALUES = $pieces[1];
                return $file;
            }
        }
        return false;
    }
1046678
private function cleanupAnchor(string $uri): string
    {
        if (false !== $pos = strpos($uri, '#')) {
            return substr($uri, 0, $pos);
        }

        return $uri;
    }
1219674
public function getUriLocale($uri)
    {
        $parts = explode('/', $uri);
        $locale = $parts[1];

        if (count($parts) < 2 || ! in_array($locale, $this->getLocales())) {
            return;
        }

        return $locale;
    }
149320
public function toBrandCoreCdn(string $uri = ''): string
    {
        if ($this->App->Parent) { // Looking for the root core.
            return $this->App->Parent->Utils->§BrandUrl->toBrandCoreCdn($uri);
        }
        return $this->toBrandCdn($uri);
    }
363580
public function uri(){
        $basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';
        $uri = substr($_SERVER['REQUEST_URI'], strlen($basepath));
        if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?'));
        $uri = '/' . trim($uri, '/');
        return $uri;
    }
1142728
public function analyseURI($uri)
    {
        if (($siteaccessPart = "/$this->key") === $uri) {
            return '/';
        }

        if (mb_strpos($uri, $siteaccessPart) === 0) {
            return mb_substr($uri, mb_strlen($siteaccessPart));
        }

        return $uri;
    }
878821
private static function key($schema, $uri)
    {
        if ($uri !== '') {
            return sha1($uri);
        }

        return sha1(is_string($schema) ? $schema : json_encode($schema));
    }
1017717
public function retrieve($uri)
    {
        $errorMessage = null;
        set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
            $errorMessage = $errstr;
        });
        $response = file_get_contents($uri);
        restore_error_handler();

        if ($errorMessage) {
            throw new ResourceNotFoundException($errorMessage);
        }

        if (false === $response) {
            throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
        }

        if ($response == ''
            && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
        ) {
            throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
        }

        $this->messageBody = $response;
        if (!empty($http_response_header)) {
            // $http_response_header cannot be tested, because it's defined in the method's local scope
            // See http://php.net/manual/en/reserved.variables.httpresponseheader.php for more info.
            $this->fetchContentType($http_response_header); // @codeCoverageIgnore
        } else {                                            // @codeCoverageIgnore
            // Could be a "file://" url or something else - fake up the response
            $this->contentType = null;
        }

        return $this->messageBody;
    }