38 foreach ($values as $var => $vals) {
39 foreach ($vals as $value) {
40 if (!is_string($value)) {
41 throw new \InvalidArgumentException(sprintf(
'All variable values must be strings, but got %s for variable "%s".', json_encode($value), $var));
47 $this->values = $values;
53 $this->writeAsset($am->
get($name));
59 foreach (VarUtils::getCombinations($asset->
getVars(), $this->values) as $combination) {
63 $this->dir.
'/'.VarUtils::resolve(
75 if (!is_dir($dir = dirname(
$path)) &&
false === @mkdir($dir, 0777,
true)) {
76 throw new \RuntimeException(
'Unable to create directory '.$dir);
80 throw new \RuntimeException(
'Unable to write file '.
$path);
92 return VarUtils::getCombinations($vars, $this->values);
Writes assets to the filesystem.
get($name)
Gets an asset by name.
getNames()
Returns an array of asset names.
__construct($dir, array $values=array())
Constructor.
writeManagerAssets(AssetManager $am)
getVars()
Returns an array of variable names for this asset.
setValues(array $values)
Sets the values for the asset's variables.
An asset has a mutable URL and content and can be loaded and dumped.
Create styles array
The data for the language used.
Class CssCacheBustingFilter.
writeAsset(AssetInterface $asset)
getCombinations(array $vars)
Not used.
static write($path, $contents)
getTargetPath()
Returns the URL for the current asset.
dump(FilterInterface $additionalFilter=null)
Applies dump filters and returns the asset as a string.
getValues()
Returns the current values for this asset.