private function addTwigPath($path, array $options = [])
    {
        if ($path === 'templates' && $this->pathAdded) {
            return;
        }

        $app = $this->getContainer();

        $position = isset($options['position']) ? $options['position'] : 'append';
        $namespace = isset($options['namespace']) ? $options['namespace'] : FilesystemLoader::MAIN_NAMESPACE;

        $dir = $this->getBaseDirectory()->getDir($path);
        if (!$dir->exists()) {
            return;
        }
        try {
            if ($position === 'prepend') {
                $app['twig.loader.bolt_filesystem']->prependDir($dir, $namespace);
            } else {
                $app['twig.loader.bolt_filesystem']->addDir($dir, $namespace);
            }
        } catch (LoaderError $e) {
            $app['logger.system']->critical(sprintf('%s was unable to add the Twig path %s. %s', $this->getName(), $path, $e->getMessage()), ['event' => 'exception', 'exception' => $e]);
        }
    }
private function addTwigPath($path, array $options = [])
    {
        if ($path === 'templates' && $this->pathAdded) {
            return;
        }

        $app = $this->getContainer();

        $position = isset($options['position']) ? $options['position'] : 'append';
        $namespace = isset($options['namespace']) ? $options['namespace'] : FilesystemLoader::MAIN_NAMESPACE;

        $dir = $this->getBaseDirectory()->getDir($path);
        if (!$dir->exists()) {
            return;
        }
        try {
            if ($position === 'prepend') {
                $app['twig.loader.bolt_filesystem']->prependDir($dir, $namespace);
            } else {
                $app['twig.loader.bolt_filesystem']->addDir($dir, $namespace);
            }
        } catch (LoaderError $e) {
            $app['logger.system']->critical(sprintf('%s was unable to add the Twig path %s. %s', $this->getName(), $path, $e->getMessage()), ['event' => 'exception', 'exception' => $e]);
        }
    }
private function addTwigPath ( $ path , array $ options = [ ] ) { if ( $ path === 'templates' && $ this -> pathAdded ) { return ; } $ app = $ this -> getContainer ( ) ; $ position = isset ( $ options [ 'position' ] ) ? $ options [ 'position' ] : 'append' ; $ namespace = isset ( $ options [ 'namespace' ] ) ? $ options [ 'namespace' ] : FilesystemLoader :: MAIN_NAMESPACE ; $ dir = $ this -> getBaseDirectory ( ) -> getDir ( $ path ) ; if ( ! $ dir -> exists ( ) ) { return ; } try { if ( $ position === 'prepend' ) { $ app [ 'twig.loader.bolt_filesystem' ] -> prependDir ( $ dir , $ namespace ) ; } else { $ app [ 'twig.loader.bolt_filesystem' ] -> addDir ( $ dir , $ namespace ) ; } } catch ( LoaderError $ e ) { $ app [ 'logger.system' ] -> critical ( sprintf ( '%s was unable to add the Twig path %s. %s' , $ this -> getName ( ) , $ path , $ e -> getMessage ( ) ) , [ 'event' => 'exception' , 'exception' => $ e ] ) ; } }
Append a path to Twig's path array.

@param string $path
@param array  $options

@throws LoaderError
Append a path to Twig s path array .