AssetCollectionInterface
interface AssetCollectionInterface implements AssetInterface, Traversable
An asset collection.
Methods
Loads the asset into memory and applies load filters.
Applies dump filters and returns the asset as a string.
Returns an absolute path or URL to the source asset's root directory.
Returns the time the current asset was last modified.
Returns all child assets.
Replaces an existing leaf with a new one.
Details
in
AssetInterface at line 28
ensureFilter(FilterInterface $filter)
Ensures the current asset includes the supplied filter.
in
AssetInterface at line 35
array
getFilters()
Returns an array of filters currently applied.
in
AssetInterface at line 40
clearFilters()
Clears all filters from the current asset.
in
AssetInterface at line 49
load(FilterInterface $additionalFilter = null)
Loads the asset into memory and applies load filters.
You may provide an additional filter to apply during load.
in
AssetInterface at line 65
string
dump(FilterInterface $additionalFilter = null)
Applies dump filters and returns the asset as a string.
You may provide an additional filter to apply during dump.
Dumping an asset should not change its state.
If the current asset has not been loaded yet, it should be automatically loaded at this time.
in
AssetInterface at line 72
string
getContent()
Returns the loaded content of the current asset.
in
AssetInterface at line 81
setContent(string $content)
Sets the content of the current asset.
Filters can use this method to change the content of the asset.
in
AssetInterface at line 97
string|null
getSourceRoot()
Returns an absolute path or URL to the source asset's root directory.
This value should be an absolute path to a directory in the filesystem, an absolute URL with no path, or null.
For example:
- '/path/to/web'
- 'http://example.com'
- null
in
AssetInterface at line 113
string|null
getSourcePath()
Returns the relative path for the source asset.
This value can be combined with the asset's source root (if both are non-null) to get something compatible with file_get_contents().
For example:
- 'js/main.js'
- 'main.js'
- null
in
AssetInterface at line 123
string|null
getSourceDirectory()
Returns the asset's source directory.
The source directory is the directory the asset was located in and can be used to resolve references relative to an asset.
in
AssetInterface at line 130
string|null
getTargetPath()
Returns the URL for the current asset.
in
AssetInterface at line 137
setTargetPath(string $targetPath)
Sets the URL for the current asset.
in
AssetInterface at line 144
int|null
getLastModified()
Returns the time the current asset was last modified.
in
AssetInterface at line 151
array
getVars()
Returns an array of variable names for this asset.
in
AssetInterface at line 158
setValues(array $values)
Sets the values for the asset's variables.
in
AssetInterface at line 165
array
getValues()
Returns the current values for this asset.
at line 26
array
all()
Returns all child assets.
at line 33
add(AssetInterface $asset)
Adds an asset to the current collection.
at line 45
bool
removeLeaf(AssetInterface $leaf, bool $graceful = false)
Removes a leaf.
at line 58
bool
replaceLeaf(AssetInterface $needle, AssetInterface $replacement, bool $graceful = false)
Replaces an existing leaf with a new one.