public function checkMapCache(string $url, string $sha1)
    {
        $this->map_cache = $this->getMapCache();

        if (isset($this->map_cache[$url]['sri']) && $this->map_cache[$url]['time'] >= $this->cache_max_age) {
            return $sri = (string) $this->map_cache[$url]['sri'];
        }
        if (mb_strpos($url, '//') !== 0) { // Should check `//`?
            ${'//'} = preg_replace('/^https?\:/ui', '', $url);

            if (isset($this->map_cache[${'//'}]['sri']) && $this->map_cache[${'//'}]['time'] >= $this->cache_max_age) {
                return $sri = (string) $this->map_cache[${'//'}]['sri'];
            } // i.e., If a map entry covers all schemes.
        }
        return $sri = null; // Not in the map.
    }
public function checkMapCache(string $url, string $sha1)
    {
        $this->map_cache = $this->getMapCache();

        if (isset($this->map_cache[$url]['sri']) && $this->map_cache[$url]['time'] >= $this->cache_max_age) {
            return $sri = (string) $this->map_cache[$url]['sri'];
        }
        if (mb_strpos($url, '//') !== 0) { // Should check `//`?
            ${'//'} = preg_replace('/^https?\:/ui', '', $url);

            if (isset($this->map_cache[${'//'}]['sri']) && $this->map_cache[${'//'}]['time'] >= $this->cache_max_age) {
                return $sri = (string) $this->map_cache[${'//'}]['sri'];
            } // i.e., If a map entry covers all schemes.
        }
        return $sri = null; // Not in the map.
    }
public function checkMapCache ( string $ url , string $ sha1 ) { $ this -> map_cache = $ this -> getMapCache ( ) ; if ( isset ( $ this -> map_cache [ $ url ] [ 'sri' ] ) && $ this -> map_cache [ $ url ] [ 'time' ] >= $ this -> cache_max_age ) { return $ sri = ( string ) $ this -> map_cache [ $ url ] [ 'sri' ] ; } if ( mb_strpos ( $ url , '//' ) !== 0 ) { // Should check `//`? $ { '//' } = preg_replace ( '/^https?\:/ui' , '' , $ url ) ; if ( isset ( $ this -> map_cache [ $ { '//' } ] [ 'sri' ] ) && $ this -> map_cache [ $ { '//' } ] [ 'time' ] >= $ this -> cache_max_age ) { return $ sri = ( string ) $ this -> map_cache [ $ { '//' } ] [ 'sri' ] ; } // i.e., If a map entry covers all schemes. } return $ sri = null ; // Not in the map. }
Checks for SRI in map cache.

@since 170211.63148 SRI utils.

@param string $url  URL to get SRI for.
@param string $sha1 SHA-1 hash of URL.

@return string|null SRI hash, else `null`.
Checks for SRI in map cache .