41 } elseif (
false === strpos(
$sourceUrl,
'://')) {
42 throw new \InvalidArgumentException(
sprintf(
'"%s" is not a valid URL.',
$sourceUrl));
49 list($host,
$path) = explode(
'/',
$url, 2);
60 if (
false ===
$content && !$this->ignoreErrors) {
61 throw new \RuntimeException(
sprintf(
'Unable to load asset from URL "%s"', $this->sourceUrl));
69 if (
false !== @file_get_contents($this->sourceUrl,
false, stream_context_create(array(
'http' => array(
'method' =>
'HEAD'))))) {
70 foreach ($http_response_header as
$header) {
71 if (0 === stripos(
$header,
'Last-Modified: ')) {
72 list(, $mtime) = explode(
':',
$header, 2);
74 return strtotime(trim($mtime));
sprintf('%.4f', $callTime)
doLoad($content, FilterInterface $additionalFilter=null)
Encapsulates asset loading logic.
getValues()
Returns the current values for this asset.
getVars()
Returns an array of variable names for this asset.
Represents an asset loaded via an HTTP request.
__construct($sourceUrl, $filters=array(), $ignoreErrors=false, array $vars=array())
Constructor.
getLastModified()
Returns the time the current asset was last modified.
load(FilterInterface $additionalFilter=null)
Loads the asset into memory and applies load filters.
static resolve($template, array $vars, array $values)
Resolves variable placeholders.
An exception for terminatinating execution or to throw for unit testing.
A filter manipulates an asset at load and dump.