Get a template function.

@param  string $name

@return callable
766778
public function getFunction($name)
    {
        if (!isset($this->functions[$name])) {
            throw new \LogicException('The template function "' . $name . '" was not found.');
        }

        return $this->functions[$name];
    }
1241222
public function method($name)
    {
        $method = new Method($name);
        $this->container->put($name, $method);

        return $method;
    }
630564
public function getTemplate($name)
    {
        dump($name);
        $templateName = $this->loader->getTemplate($name);
        try {
            $template = $this->environment->loadTemplate($templateName);
        } catch (\Twig_Error_Loader $e) {
            throw $e;
        }

        return $template;
    }
722878
public function load($name)
    {
        $this->loadTemplates();

        if (!array_key_exists($name, $this->templates)) {
            throw new Mustache_Exception_UnknownTemplateException($name);
        }

        return $this->templates[$name];
    }
285964
public function getCallable($name)
     {
         if (method_exists($this, $name)) {
             return call_user_func([$this, $name]);
         } else {
             throw new InvalidArgumentException('Undefined property: '.get_class($this)."::$name");
         }
     }
666956
protected function findTemplate($name)
    {
        $finder = App::make('view')->getFinder();

        if (isset($this->cache[$name])) {
            return $this->cache[$name];
        }

        if (File::isFile($name)) {
            return $this->cache[$name] = $name;
        }

        $view = $name;
        if (File::extension($view) === $this->extension) {
            $view = substr($view, 0, -strlen($this->extension));
        }

        $path = $finder->find($view);
        return $this->cache[$name] = $path;
    }
1144690
public function getFinalName($name){

        try { 

            return parent::findTemplate($name);

        } catch(\Twig_Error_Loader $e){ 

            $exts = \App::config('TEMPLATE_EXTENSION');

            if($exts){

                if(!is_array($exts)){
                    $exts = Array($exts);
                }//if

                foreach($exts as $e){

                    try {
                        return parent::findTemplate($name . $e);
                    } catch(\Twig_Error_Loader $e){ }

                }//foreach

            }//if

        }//catch

        throw new \Twig_Error_Loader("Twig Error Loader Exception : Could name find template `{$name}`");

    }
179149
public function get(string $name): TemplateInterface
    {
        if (!isset($this->engines[$name])) {
            throw new InvalidArgumentException('Template engine "' . $name . '" is not known or registered');
        }

        return $this->engines[$name];
    }
1051048
public function findTemplate($name)
    {
        if ($this->files->exists($name)) {
            return $name;
        }

        $name = $this->normalizeName($name);

        if (isset($this->cache[$name])) {
            return $this->cache[$name];
        }

        try {
            $this->cache[$name] = $this->finder->find($name);
        } catch (InvalidArgumentException $ex) {
            throw new LoaderError($ex->getMessage());
        }

        return $this->cache[$name];
    }
671123
public function getFunction(string $name): ?FunctionModelInterface
    {
        $functions = $this->functions->filter(function (FunctionModelInterface $function) use ($name) {
            return $function->getName() === $name;
        });
        if ($functions->isEmpty()) {
            return null;
        }
        return $functions->first();
    }
76544
public function get( $name )
	{
		$mbegin = str_replace( '$', $name, $this->_begin );
		$mend = str_replace( '$', $name, $this->_end );

		if( ( $begin = strpos( $this->_text, $mbegin ) ) === false )
		{
			throw new MW_Template_Exception( sprintf( 'Error finding begin of marker "%1$s" in template', $name ) );
		}

		$begin += strlen( $mbegin );

		if( ( $end = strpos( $this->_text, $mend, $begin ) ) === false )
		{
			throw new MW_Template_Exception( sprintf( 'Error finding end of marker "%1$s" in template', $name ) );
		}

		return new self( substr( $this->_text, $begin, $end - $begin ), $this->_begin, $this->_end );
	}
785083
public function getMigrationTemplate( $name )
    {
        $template = '<?php' . PHP_EOL . PHP_EOL;
        
        if ( '' !== $this->migrationNamespace )
        {
            $template .= 'namespace ' . $this->migrationNamespace . ';' . PHP_EOL . PHP_EOL;
        }
        
        $template .= 'use RawPHP\RawMigrator\Migration;' . PHP_EOL;
        $template .= 'use RawPHP\RawDatabase\IDatabase;' . PHP_EOL . PHP_EOL;
        
        $template .= 'class ' . $name . ' extends Migration' . PHP_EOL;
        $template .= '{' . PHP_EOL;
        
        $template .= '    /**' . PHP_EOL;
        $template .= '     * Implement database changes here.' . PHP_EOL;
        $template .= '     * ' . PHP_EOL;
        $template .= '     * @param IDatabase $db database instance' . PHP_EOL;
        $template .= '     */' . PHP_EOL;
        $template .= '    public function migrateUp( IDatabase $db )' . PHP_EOL;
        $template .= '    {' . PHP_EOL;
        $template .= '        ' . PHP_EOL;
        $template .= '    }' . PHP_EOL . PHP_EOL;
        
        $template .= '    /**' . PHP_EOL;
        $template .= '     * Implement reverting changes here.' . PHP_EOL;
        $template .= '     * ' . PHP_EOL;
        $template .= '     * @param IDatabase $db database instance' . PHP_EOL;
        $template .= '     */' . PHP_EOL;
        $template .= '    public function migrateDown( IDatabase $db )' . PHP_EOL;
        $template .= '    {' . PHP_EOL;
        $template .= '        ' . PHP_EOL;
        $template .= '    }' . PHP_EOL . PHP_EOL;
        
        $template .= '    /**' . PHP_EOL;
        $template .= '     * Alternatively to <code>migrateUp()</code>, this method will' . PHP_EOL;
        $template .= '     * use transactions (if available) to process the database changes.' .
                          PHP_EOL;
        $template .= '     * ' . PHP_EOL;
        $template .= '     * @param IDatabase $db database instance' . PHP_EOL;
        $template .= '     */' . PHP_EOL;
        $template .= '    public function safeMigrateUp( IDatabase $db )' . PHP_EOL;
        $template .= '    {' . PHP_EOL;
        $template .= '        ' . PHP_EOL;
        $template .= '    }' . PHP_EOL . PHP_EOL;
        
        $template .= '    /**' . PHP_EOL;
        $template .= '     * Alternatively to <code>migrateDown()</code>, this method will' . 
                          PHP_EOL;
        $template .= '     * use transactions (if available) to revert changes.' . PHP_EOL;
        $template .= '     * ' . PHP_EOL;
        $template .= '     * @param IDatabase $db database instance' . PHP_EOL;
        $template .= '     */' . PHP_EOL;
        $template .= '    public function safeMigrateDown( IDatabase $db )' . PHP_EOL;
        $template .= '    {' . PHP_EOL;
        $template .= '        ' . PHP_EOL;
        $template .= '    }' . PHP_EOL;
        $template .= '}';
        
        return $this->filter( self::ON_GET_MIGRATION_TEMPLATE_FILTER, $template, $name );
    }
871500
public function make(string $name): Template
    {
        $name = \trim($name, '/\\');
        $file = $this->compile($name);

        return new Template($this, $name, $file);
    }
511461
public function getNamedTemplate($name)
    {
        if ($importedTemplate = singleton(WorkflowDefinitionImporter::class)->getImportedWorkflows($name)) {
            return $importedTemplate;
        }

        if (!is_array($this->templates)) {
            return;
        }
        foreach ($this->templates as $template) {
            if ($template->getName() == $name) {
                return $template;
            }
        }
    }
1225089
function getSource($name)
    {
        if (isset($this->site->pages[$name])) {
            $content = $this->site->pages[$name];
        }
        else {
            throw new \Exception("Cannot find content \"$name\".");
        }

        if (!$content->template) {
            throw new \Exception("Content does not have a template");
        }

        if ($content->template !== 'none') {
            $block = 'content';

            // Custom Block?
            if (strpos($content->template, '::') !== false) {
                list($content->template, $block) = explode('::', $content->template);
            }

            // Create template content
            $template = "{% extends \"$content->template\" %}";
            $template .= "{% block $block %}";
            $template .= $content->content;
            $template .= "{% endblock %}";
        }
        else {
            $template = $content->content;
        }

        return $template;
    }
1179677
protected function getBuiltinFunction($name)
    {
        $libName = 'lib' . preg_replace_callback(
            '/_(.)/',
            function ($m) {
                return ucfirst($m[1]);
            },
            ucfirst($name)
        );

        return [$this, $libName];
    }
1209150
public function getSource($name)
    {
        $this->getFileOrFail($name);

        return $this->filesystem->read($this->resolveTemplateName($name));
    }