AssetFactory
class AssetFactory
The asset factory creates asset objects.
Properties
private | $root | ||
private | $debug | ||
private | $output | ||
private | $workers | ||
private | $am | ||
private | $fm |
Methods
Constructor.
Sets debug mode for the current factory.
Checks if the factory is in debug mode.
Sets the default output string.
Returns the current asset manager.
Returns the current filter manager.
Creates a new asset.
No description
Parses an input string string into an asset.
No description
No description
No description
No description
No description
No description
Filters an asset collection through the factory workers.
No description
Loops through the root directories and returns the first match.
Details
at line 50
__construct(string $root, bool $debug = false)
Constructor.
at line 63
setDebug(bool $debug)
Sets debug mode for the current factory.
at line 73
bool
isDebug()
Checks if the factory is in debug mode.
at line 83
setDefaultOutput(string $output)
Sets the default output string.
at line 93
AssetManager|null
getAssetManager()
Returns the current asset manager.
at line 103
setAssetManager(AssetManager $am)
Sets the asset manager to use when creating asset references.
at line 113
FilterManager|null
getFilterManager()
Returns the current filter manager.
at line 123
setFilterManager(FilterManager $fm)
Sets the filter manager to use when adding filters.
at line 147
AssetCollection
createAsset(array|string $inputs = [], array|string $filters = [], array $options = [])
Creates a new asset.
Prefixing a filter name with a question mark will cause it to be omitted when the factory is in debug mode.
Available options:
- output: An output string
- name: An asset name for interpolation in output patterns
- debug: Forces debug mode on or off for this asset
- root: An array or string of more root directories
at line 237
generateAssetName($inputs, $filters, $options = [])
No description
at line 248
getLastModified(AssetInterface $asset)
No description
at line 300
protected AssetInterface
parseInput(string $input, array $options = [])
Parses an input string string into an asset.
The input string can be one of the following:
- A reference: If the string starts with an "at" sign it will be interpreted as a reference to an asset in the asset manager
- An absolute URL: If the string contains "://" or starts with "//" it will be interpreted as an HTTP asset
- A glob: If the string contains a "*" it will be interpreted as a glob
- A path: Otherwise the string is interpreted as a filesystem path
Both globs and paths will be absolutized using the current root directory.
at line 331
protected
createAssetCollection(array $assets = [], array $options = [])
No description
at line 336
protected
createAssetReference($name)
No description
at line 345
protected
createHttpAsset($sourceUrl, $vars)
No description
at line 350
protected
createGlobAsset($glob, $root = null, $vars = [])
No description
at line 355
protected
createFileAsset($source, $root = null, $path = null, $vars = [])
No description
at line 360
protected
getFilter($name)
No description
at line 379
private AssetCollectionInterface
applyWorkers(AssetCollectionInterface $asset)
Filters an asset collection through the factory workers.
Each leaf asset will be processed first, followed by the asset collection itself.
at line 402
static private
isAbsolutePath($path)
No description
at line 415
static private string|null
findRootDir(string $path, array $roots)
Loops through the root directories and returns the first match.