Jose\Object\DownloadedJWKSet::__construct PHP Method

__construct() public method

DownloadedJWKSet constructor.
public __construct ( string $url, Psr\Cache\CacheItemPoolInterface $cache = null, integer $ttl = 86400, boolean $allow_unsecured_connection = false, boolean $allow_http_connection = false )
$url string
$cache Psr\Cache\CacheItemPoolInterface
$ttl integer
$allow_unsecured_connection boolean
$allow_http_connection boolean
    public function __construct($url, CacheItemPoolInterface $cache = null, $ttl = 86400, $allow_unsecured_connection = false, $allow_http_connection = false)
    {
        Assertion::boolean($allow_unsecured_connection);
        Assertion::boolean($allow_http_connection);
        Assertion::integer($ttl);
        Assertion::min($ttl, 0);
        Assertion::false(false === filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED), 'Invalid URL.');
        $allowed_protocols = ['https'];
        if (true === $allow_http_connection) {
            $allowed_protocols[] = 'http';
        }
        Assertion::inArray(mb_substr($url, 0, mb_strpos($url, '://', 0, '8bit'), '8bit'), $allowed_protocols, sprintf('The provided sector identifier URI is not valid: scheme must be one of the following: %s.', json_encode($allowed_protocols)));
        $this->url = $url;
        $this->cache = $cache;
        $this->ttl = $ttl;
        $this->allow_unsecured_connection = $allow_unsecured_connection;
    }