From: Fabien Potencier Date: Tue, 7 Jun 2011 14:33:55 +0000 (+0200) Subject: added Twig_Loader_Filesystem::addPath() X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=cd0e749308e8692ab7aee15b71c220d20c3088bc;p=konrad%2Ftwig.git added Twig_Loader_Filesystem::addPath() --- diff --git a/lib/Twig/Loader/Filesystem.php b/lib/Twig/Loader/Filesystem.php index b4a3887..08e9c2c 100644 --- a/lib/Twig/Loader/Filesystem.php +++ b/lib/Twig/Loader/Filesystem.php @@ -47,21 +47,31 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface */ public function setPaths($paths) { - // invalidate the cache - $this->cache = array(); - if (!is_array($paths)) { $paths = array($paths); } $this->paths = array(); foreach ($paths as $path) { - if (!is_dir($path)) { - throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path)); - } + $this->addPath($path); + } + } + + /** + * Adds a path where templates are stored. + * + * @param string $path A path where to look for templates + */ + public function addPath($path) + { + // invalidate the cache + $this->cache = array(); - $this->paths[] = $path; + if (!is_dir($path)) { + throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path)); } + + $this->paths[] = $path; } /**