Source of file AssetReference.php
Size: 2,841 Bytes - Last Modified: 2013-06-02T00:13:43+02:00
/home/theseer/Downloads/Symfony/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetReference.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 | <?php /* * This file is part of the Assetic package, an OpenSky project. * * (c) 2010-2013 OpenSky Project Inc * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Assetic\Asset; use Assetic\AssetManager; use Assetic\Filter\FilterInterface; /** * A reference to an asset in the asset manager. * * @author Kris Wallsmith <kris.wallsmith@gmail.com> */ class AssetReference implements AssetInterface { private $am; private $name; private $filters = array(); public function __construct(AssetManager $am, $name) { $this->am = $am; $this->name = $name; } public function ensureFilter(FilterInterface $filter) { $this->filters[] = $filter; } public function getFilters() { $this->flushFilters(); return $this->callAsset(__FUNCTION__); } public function clearFilters() { $this->filters = array(); $this->callAsset(__FUNCTION__); } public function load(FilterInterface $additionalFilter = null) { $this->flushFilters(); return $this->callAsset(__FUNCTION__, array($additionalFilter)); } public function dump(FilterInterface $additionalFilter = null) { $this->flushFilters(); return $this->callAsset(__FUNCTION__, array($additionalFilter)); } public function getContent() { return $this->callAsset(__FUNCTION__); } public function setContent($content) { $this->callAsset(__FUNCTION__, array($content)); } public function getSourceRoot() { return $this->callAsset(__FUNCTION__); } public function getSourcePath() { return $this->callAsset(__FUNCTION__); } public function getTargetPath() { return $this->callAsset(__FUNCTION__); } public function setTargetPath($targetPath) { $this->callAsset(__FUNCTION__, array($targetPath)); } public function getLastModified() { return $this->callAsset(__FUNCTION__); } public function getVars() { return $this->callAsset(__FUNCTION__); } public function getValues() { return $this->callAsset(__FUNCTION__); } public function setValues(array $values) { $this->callAsset(__FUNCTION__, array($values)); } // private private function callAsset($method, $arguments = array()) { $asset = $this->am->get($this->name); return call_user_func_array(array($asset, $method), $arguments); } private function flushFilters() { $asset = $this->am->get($this->name); while ($filter = array_shift($this->filters)) { $asset->ensureFilter($filter); } } } |