src/includes/classes/Core/Utils/Sri.php
public function checkContents(string $url, string $sha1)
    {
        if (static::$content_checks >= $this->max_content_checks) {
            return $sri = null; // Not possible at this time.
        } // There is a limit on the number of checks per process.

        if (mb_stripos($url, '//') === 0) {
            $url = ($this->current_scheme ?: 'http').':'.$url;
        } // Because we must have a scheme to do a lookup.

        $args = [ // HTTP args.
            'max_con_secs'    => 2,
            'max_stream_secs' => 6,
            'max_stream_size' => $this::BYTES_IN_MB * 2,
        ]; // Most servers can download 1MB+ in this time.

        ++static::$content_checks; // Increment counter.
        $response = $this->c::remoteResponse('GET::'.$url, $args);

        if ($response->code !== 200) {
            return $sri = ''; // Unable to determine.
            // However, we do return an empty SRI in this case anyway.

            // NOTE: This may (at times) return an empty SRI whenever
            // there is a temporary connectivity issue that is resolved later.

            // Rationale: If we chose not to cache failed responses, that could result in HTTP
            // requests occurring over and over again, which is want we need to avoid at all costs.
            // Therefore, if it fails, game is over until clearing the cache or adding a new map entry.
        }
        return $sri = 'sha384-'.base64_encode(hash('sha384', $response->body, true));
    }
public function checkContents(string $url, string $sha1)
    {
        if (static::$content_checks >= $this->max_content_checks) {
            return $sri = null; // Not possible at this time.
        } // There is a limit on the number of checks per process.

        if (mb_stripos($url, '//') === 0) {
            $url = ($this->current_scheme ?: 'http').':'.$url;
        } // Because we must have a scheme to do a lookup.

        $args = [ // HTTP args.
            'max_con_secs'    => 2,
            'max_stream_secs' => 6,
            'max_stream_size' => $this::BYTES_IN_MB * 2,
        ]; // Most servers can download 1MB+ in this time.

        ++static::$content_checks; // Increment counter.
        $response = $this->c::remoteResponse('GET::'.$url, $args);

        if ($response->code !== 200) {
            return $sri = ''; // Unable to determine.
            // However, we do return an empty SRI in this case anyway.

            // NOTE: This may (at times) return an empty SRI whenever
            // there is a temporary connectivity issue that is resolved later.

            // Rationale: If we chose not to cache failed responses, that could result in HTTP
            // requests occurring over and over again, which is want we need to avoid at all costs.
            // Therefore, if it fails, game is over until clearing the cache or adding a new map entry.
        }
        return $sri = 'sha384-'.base64_encode(hash('sha384', $response->body, true));
    }
Check contents.

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