public function checkMap(string $url, string $sha1)
    {
        $this->map = $this->getMap();

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

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

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

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

@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 .