diff -r 000000000000 -r 7f95f8617b0b vendor/assetic/src/Assetic/Extension/Twig/TwigResource.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/assetic/src/Assetic/Extension/Twig/TwigResource.php Sat Sep 24 15:40:41 2011 +0200 @@ -0,0 +1,54 @@ + + */ +class TwigResource implements ResourceInterface +{ + private $loader; + private $name; + + public function __construct(\Twig_LoaderInterface $loader, $name) + { + $this->loader = $loader; + $this->name = $name; + } + + public function getContent() + { + try { + return $this->loader->getSource($this->name); + } catch (\Twig_Error_Loader $e) { + return ''; + } + } + + public function isFresh($timestamp) + { + try { + return $this->loader->isFresh($this->name, $timestamp); + } catch (\Twig_Error_Loader $e) { + return false; + } + } + + public function __toString() + { + return $this->name; + } +}