ILIAS
release_5-2 Revision v5.2.25-18-g3f80b828510
|
Caches an asset to avoid the cost of loading and dumping. More...
Public Member Functions | |
__construct (AssetInterface $asset, CacheInterface $cache) | |
ensureFilter (FilterInterface $filter) | |
Ensures the current asset includes the supplied filter. More... | |
getFilters () | |
Returns an array of filters currently applied. More... | |
clearFilters () | |
Clears all filters from the current asset. More... | |
load (FilterInterface $additionalFilter=null) | |
Loads the asset into memory and applies load filters. More... | |
dump (FilterInterface $additionalFilter=null) | |
Applies dump filters and returns the asset as a string. More... | |
getContent () | |
Returns the loaded content of the current asset. More... | |
setContent ($content) | |
Sets the content of the current asset. More... | |
getSourceRoot () | |
Returns an absolute path or URL to the source asset's root directory. More... | |
getSourcePath () | |
Returns the relative path for the source asset. More... | |
getSourceDirectory () | |
Returns the asset's source directory. More... | |
getTargetPath () | |
Returns the URL for the current asset. More... | |
setTargetPath ($targetPath) | |
Sets the URL for the current asset. More... | |
getLastModified () | |
Returns the time the current asset was last modified. More... | |
getVars () | |
Returns an array of variable names for this asset. More... | |
setValues (array $values) | |
Sets the values for the asset's variables. More... | |
getValues () | |
Returns the current values for this asset. More... | |
Static Private Member Functions | |
static | getCacheKey (AssetInterface $asset, FilterInterface $additionalFilter=null, $salt='') |
Returns a cache key for the current asset. More... | |
Private Attributes | |
$asset | |
$cache | |
Caches an asset to avoid the cost of loading and dumping.
Definition at line 23 of file AssetCache.php.
Assetic\Asset\AssetCache::__construct | ( | AssetInterface | $asset, |
CacheInterface | $cache | ||
) |
Definition at line 28 of file AssetCache.php.
References Assetic\Asset\AssetCache\$asset, and Assetic\Asset\AssetCache\$cache.
Assetic\Asset\AssetCache::clearFilters | ( | ) |
Clears all filters from the current asset.
Implements Assetic\Asset\AssetInterface.
Definition at line 44 of file AssetCache.php.
Assetic\Asset\AssetCache::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.
FilterInterface | $additionalFilter | An additional filter |
Implements Assetic\Asset\AssetInterface.
Definition at line 62 of file AssetCache.php.
Assetic\Asset\AssetCache::ensureFilter | ( | FilterInterface | $filter | ) |
Ensures the current asset includes the supplied filter.
FilterInterface | $filter | A filter |
Implements Assetic\Asset\AssetInterface.
Definition at line 34 of file AssetCache.php.
|
staticprivate |
Returns a cache key for the current asset.
The key is composed of everything but an asset's content:
AssetInterface | $asset | The asset |
FilterInterface | $additionalFilter | Any additional filter being applied |
string | $salt | Salt for the key |
Definition at line 147 of file AssetCache.php.
References Assetic\Asset\AssetCache\$asset, Assetic\Asset\AssetInterface\getFilters(), Assetic\Asset\AssetInterface\getLastModified(), Assetic\Asset\AssetInterface\getSourcePath(), Assetic\Asset\AssetInterface\getSourceRoot(), Assetic\Asset\AssetInterface\getTargetPath(), and Assetic\Asset\AssetInterface\getValues().
Assetic\Asset\AssetCache::getContent | ( | ) |
Returns the loaded content of the current asset.
Implements Assetic\Asset\AssetInterface.
Definition at line 75 of file AssetCache.php.
Assetic\Asset\AssetCache::getFilters | ( | ) |
Returns an array of filters currently applied.
Implements Assetic\Asset\AssetInterface.
Definition at line 39 of file AssetCache.php.
Assetic\Asset\AssetCache::getLastModified | ( | ) |
Returns the time the current asset was last modified.
Implements Assetic\Asset\AssetInterface.
Definition at line 110 of file AssetCache.php.
Assetic\Asset\AssetCache::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.
Implements Assetic\Asset\AssetInterface.
Definition at line 95 of file AssetCache.php.
Assetic\Asset\AssetCache::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:
Implements Assetic\Asset\AssetInterface.
Definition at line 90 of file AssetCache.php.
Assetic\Asset\AssetCache::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:
Implements Assetic\Asset\AssetInterface.
Definition at line 85 of file AssetCache.php.
Assetic\Asset\AssetCache::getTargetPath | ( | ) |
Returns the URL for the current asset.
Implements Assetic\Asset\AssetInterface.
Definition at line 100 of file AssetCache.php.
Assetic\Asset\AssetCache::getValues | ( | ) |
Returns the current values for this asset.
Implements Assetic\Asset\AssetInterface.
Definition at line 125 of file AssetCache.php.
Assetic\Asset\AssetCache::getVars | ( | ) |
Returns an array of variable names for this asset.
Implements Assetic\Asset\AssetInterface.
Definition at line 115 of file AssetCache.php.
Assetic\Asset\AssetCache::load | ( | FilterInterface | $additionalFilter = null | ) |
Loads the asset into memory and applies load filters.
You may provide an additional filter to apply during load.
FilterInterface | $additionalFilter | An additional filter |
Implements Assetic\Asset\AssetInterface.
Definition at line 49 of file AssetCache.php.
Assetic\Asset\AssetCache::setContent | ( | $content | ) |
Sets the content of the current asset.
Filters can use this method to change the content of the asset.
string | $content | The asset content |
Implements Assetic\Asset\AssetInterface.
Definition at line 80 of file AssetCache.php.
Assetic\Asset\AssetCache::setTargetPath | ( | $targetPath | ) |
Sets the URL for the current asset.
string | $targetPath | A web URL where the asset will be dumped |
Implements Assetic\Asset\AssetInterface.
Definition at line 105 of file AssetCache.php.
Assetic\Asset\AssetCache::setValues | ( | array | $values | ) |
Sets the values for the asset's variables.
array | $values |
Implements Assetic\Asset\AssetInterface.
Definition at line 120 of file AssetCache.php.
|
private |
Definition at line 25 of file AssetCache.php.
Referenced by Assetic\Asset\AssetCache\__construct(), and Assetic\Asset\AssetCache\getCacheKey().
|
private |
Definition at line 26 of file AssetCache.php.
Referenced by Assetic\Asset\AssetCache\__construct().