public function addDir(DirectoryInterface $dir, $namespace = self::MAIN_NAMESPACE)
    {
        // invalidate the cache
        $this->cache = $this->errorCache = [];

        if (!$dir->exists()) {
            throw new LoaderError(sprintf('The "%s" directory does not exist.', $dir->getFullPath()));
        }
        if (!$dir->isDir()) {
            throw new LoaderError(sprintf('The path "%s" is not a directory.', $dir->getFullPath()));
        }

        $this->paths[$namespace][] = $dir;
    }
public function addDir(DirectoryInterface $dir, $namespace = self::MAIN_NAMESPACE)
    {
        // invalidate the cache
        $this->cache = $this->errorCache = [];

        if (!$dir->exists()) {
            throw new LoaderError(sprintf('The "%s" directory does not exist.', $dir->getFullPath()));
        }
        if (!$dir->isDir()) {
            throw new LoaderError(sprintf('The path "%s" is not a directory.', $dir->getFullPath()));
        }

        $this->paths[$namespace][] = $dir;
    }
public function addDir ( DirectoryInterface $ dir , $ namespace = self :: MAIN_NAMESPACE ) { // invalidate the cache $ this -> cache = $ this -> errorCache = [ ] ; if ( ! $ dir -> exists ( ) ) { throw new LoaderError ( sprintf ( 'The "%s" directory does not exist.' , $ dir -> getFullPath ( ) ) ) ; } if ( ! $ dir -> isDir ( ) ) { throw new LoaderError ( sprintf ( 'The path "%s" is not a directory.' , $ dir -> getFullPath ( ) ) ) ; } $ this -> paths [ $ namespace ] [ ] = $ dir ; }
Adds a directory where templates are stored.

@param DirectoryInterface $dir
@param string             $namespace

@throws LoaderError
Adds a directory where templates are stored .