src/includes/classes/Core/Utils/Sri.php
public function mapCacheIt(string $url, string $sha1, string $sri)
    {
        $this->map_cache       = $this->getMapCache();
        $this->map_cache[$url] = ['time' => time(), 'sri' => $sri];

        if (mb_strpos($url, '//') === 0) {
            unset($this->map_cache['http:'.$url]);
            unset($this->map_cache['https:'.$url]);
        } // Don't need all schemes, `//` will suffice.

        foreach ($this->map_cache as $_url => $_entry) {
            if ($_entry['time'] < $this->cache_max_age) {
                unset($this->map_cache[$_url]);
            } // Purges stale cache entries.
        } // unset($_url, $_entry); // Housekeeping.

        $map_cache_dir   = dirname($this->map_cache_file);
        $transient_perms = $this->App->Config->©fs_permissions['©transient_dirs'];

        if (!is_dir($map_cache_dir)) {
            mkdir($map_cache_dir, $transient_perms, true);
        }
        file_put_contents($this->map_cache_file, json_encode($this->map_cache, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
    }
public function mapCacheIt(string $url, string $sha1, string $sri)
    {
        $this->map_cache       = $this->getMapCache();
        $this->map_cache[$url] = ['time' => time(), 'sri' => $sri];

        if (mb_strpos($url, '//') === 0) {
            unset($this->map_cache['http:'.$url]);
            unset($this->map_cache['https:'.$url]);
        } // Don't need all schemes, `//` will suffice.

        foreach ($this->map_cache as $_url => $_entry) {
            if ($_entry['time'] < $this->cache_max_age) {
                unset($this->map_cache[$_url]);
            } // Purges stale cache entries.
        } // unset($_url, $_entry); // Housekeeping.

        $map_cache_dir   = dirname($this->map_cache_file);
        $transient_perms = $this->App->Config->©fs_permissions['©transient_dirs'];

        if (!is_dir($map_cache_dir)) {
            mkdir($map_cache_dir, $transient_perms, true);
        }
        file_put_contents($this->map_cache_file, json_encode($this->map_cache, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
    }
Map-cache the SRI hash.

@since 170211.63148 SRI utils.

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

@note The `$sri` is allowed to be empty.