*/
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;
}
/**