mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
added Twig_Loader_Filesystem::addPath()
This commit is contained in:
@@ -47,23 +47,33 @@ 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->paths[] = $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();
|
||||
|
||||
if (!is_dir($path)) {
|
||||
throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path));
|
||||
}
|
||||
|
||||
$this->paths[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source code of a template, given its name.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user