Constructor.
string $sourceUrl The source URL:
array $filters An array of filters:
Boolean $ignoreErrors:
array $vars:
\InvalidArgumentException If the first argument is not an URL
Overrides BaseAsset::__construct
public function __construct($sourceUrl, $filters = array(), $ignoreErrors = false, array $vars = array()) {
if (0 === strpos($sourceUrl, '//')) {
$sourceUrl = 'http:' . $sourceUrl;
}
elseif (false === strpos($sourceUrl, '://')) {
throw new \InvalidArgumentException(sprintf('"%s" is not a valid URL.', $sourceUrl));
}
$this->sourceUrl = $sourceUrl;
$this->ignoreErrors = $ignoreErrors;
list($scheme, $url) = explode('://', $sourceUrl, 2);
list($host, $path) = explode('/', $url, 2);
parent::__construct($filters, $scheme . '://' . $host, $path, $vars);
}