Sets the templates path.

@param  string                 $path
@param  \Twig_Environment|null $twig
@param  array                  $extensions
@return self
161111
public function setTemplatePath($path, \Twig_Environment $twig = null, $extensions = [])
    {
        $this->paths['templates'] = $path;

        if (is_null($twig) === true) {
            $loader = new \Twig_Loader_Filesystem($path);

            $twig = new \Twig_Environment($loader);
        }

        $twig->setExtensions($extensions);

        $this->injector->share($twig);

        return $this;
    }
501780
public function setPath($path)
    {
        if(empty($path)) {
            $this->_path = '/';
        } else {
            $this->_path = $path;
        }

        return $this;
    }
971246
protected function loadTemplate( $path, array $vars = [] ) {

		$search = '/templates/epub201/';
		$replace = '/templates/epub3/';

		$pos = strpos( $path, $search );
		if ( false !== $pos ) {
			$new_path = substr_replace( $path, $replace, $pos, strlen( $search ) );
			if ( file_exists( $new_path ) ) {
				$path = $new_path;
			}
		}

		return parent::loadTemplate( $path, $vars );
	}
103165
public function addPath($path, $namespace = null)
    {
        $key = (is_null($namespace)) ? $path : $namespace . '::' . $path;

        $this->fullQualifiedPathNameWithTemplatePath[$key] = new TemplatePath($path, $namespace);
    }
385988
public function setTemplatePathAndFilename($templatePathAndFilename)
    {
        $this->baseRenderingContext->getTemplatePaths()->setTemplatePathAndFilename($templatePathAndFilename);

        $partialRootPaths = $this->baseRenderingContext->getTemplatePaths()->getPartialRootPaths();
        $layoutRootPaths = $this->baseRenderingContext->getTemplatePaths()->getLayoutRootPaths();
        array_unshift($partialRootPaths, Files::concatenatePaths([dirname($templatePathAndFilename), 'Partials']));
        array_unshift($layoutRootPaths, Files::concatenatePaths([dirname($templatePathAndFilename), 'Layouts']));
        $this->baseRenderingContext->getTemplatePaths()->setPartialRootPaths($partialRootPaths);
        $this->baseRenderingContext->getTemplatePaths()->setLayoutRootPaths($layoutRootPaths);
    }
116384
private function setDirectories($paths)
    {
        if (!empty($paths)) {
            foreach ($paths as $key => $dir) {
                $path = str_replace('.', DS, $dir);

                //Iterate through all paths and filter with extension provided
                $recursiveExtensionFilter = new FileExtensionFilter(
                    new \RecursiveDirectoryIterator($path)
                );

                // loop through the directory listing
                // we need to create a RecursiveIteratorIterator instance
                foreach ($recursiveExtensionFilter as $item) {
                    $alias = str_replace('.php', '', $item->getPathName());

                    $alias = implode('\\', array_map('ucfirst', explode(DS, $alias)));
                    if (!isset($this->directories[$alias])) {
                        $this->directories[str_replace('Src', '', $alias)] = str_replace('\\', '/', $item->getPathName());
                    }
                }
            }
        }
    }
619538
function setPath($path = null)
    {
        if ($path === null)
            $path = array();

        // the associate array is useless
        $this->_pathSequence = array_values( (array) $path);
        return $this;
    }
1249542
public function setExtension(string $extension)
    {
        $old = $this->getPath();
        $new = $this->getLocation().DIRECTORY_SEPARATOR.$this->getName();

        if(!empty($extension)) {
            $new .= ".{$extension}";
        }

        if(rename($old, $new)) {
            $this->_extension = $extension;
        }
    }
1115518
public function path($path = '')
    {
        $this->_sty->setTemplateDir($path);
        $this->root = $path;
        return $this;
    }
242667
public function addPath($path)
    {
        try {
            $this->twigFileLoader->addPath($path);
        } catch (\Twig_Error_Loader $e) {
            throw new InvalidPathException($e->getMessage());
        }
    }
1040744
public function setTemplate($path)
    {
        $this->_prepared = false;
        $this->_functionName = null;
        $this->_codeFile = null;
        $this->_path = $path;
        $this->_source = null;
        $this->_context->_docType = null;
        $this->_context->_xmlDeclaration = null;
        return $this;
    }
402180
public function add_extension( Twig_ExtensionInterface $extension ) {
		$env  = $this->instance();
		$exts = $env->getExtensions();

		if ( isset( $exts[$extension->getName()] ) ) {
			return;
		}

		try {
			$env->addExtension( $extension );
		} catch ( LogicException $e ) {
			return;
		}
	}
471570
public function generateTwigExtensions($parameters)
    {
        $relPath = '/Twig/';
        if ($this->demosite) {
            $this->renderSingleFile($this->skeletonDir.$relPath, $this->bundle->getPath().$relPath, 'BikesTwigExtension.php', $parameters, true);
        }

        if ($this->isSymfony4()) {
            return;
        }

        $relPath = '/Resources/config/';
        $sourceDir = $this->skeletonDir.$relPath;
        $targetDir = $this->bundle->getPath().$relPath;
        $this->renderSingleFile($sourceDir, $targetDir, 'services.yml', $parameters, true);
    }
362376
public function setExtension($extension) {
		$pathinfo = pathinfo($this->pathname);
		
		$pathname = new Text($pathinfo['dirname']);
		if (!empty($pathinfo['dirname'])) {
			$pathname = $pathname->append('/');
		}
		
		$this->init($pathname
			->append($pathinfo['filename'])
			->append('.')
			->append($extension))
		;

		return $this;
	}
997119
public function setPath(Path $path = null)
    {
        if (!empty($this->path)) {
            $this->path->removeStep($this);
        }

        $this->path = $path;

        if (!empty($path)) {
            $path->addStep($this);
        }

        return $this;
    }
1076466
static function AddExtension($path, $extension, $replaceExisting = false)
    {
        $result = $path;
        if ($replaceExisting)
        {
            $result = self::RemoveExtension($path);
        }
        if (!$extension) {
            return $result;
        }
        return join('.', array($result, System\Str::TrimLeft($extension, '.')));
    }
928286
private function setTemplatesPath($templatesPath)
    {
        $this->templatesPath = $templatesPath;
        if (!is_readable($this->templatesPath)) {
            $this->error("Template Root Path ({$this->templatesPath}) does not exist or not readable.");
        }
    }