Internal method that checks if the template name matches
the loaded object, with fallback support to partials.

@return bool
770952
protected function validateCmsObject($name)
    {
        if ($name === $this->obj->getFilePath()) {
            return true;
        }

        if ($fallbackObj = $this->findFallbackObject($name)) {
            $this->obj = $fallbackObj;
            return true;
        }

        return false;
    }
467328
public function templateOptionsMetadata()
    {
        if ($this->areTemplateOptionsFinalized === false) {
            $this->areTemplateOptionsFinalized = true;
            $this->prepareTemplateOptions();
        }

        return $this->templateOptionsMetadata;
    }
560316
public function getTemplatesToGenerate()
    {
        return parent::getTemplatesToGenerate() + array(
            'ListBuilderTemplate'.self::TWIG_EXTENSION
                => 'Resources/views/'.$this->getBaseGeneratorName().'List/index.html.twig',
            'List/FiltersBuilderTemplate'.self::TWIG_EXTENSION
                => 'Resources/views/'.$this->getBaseGeneratorName().'List/filters.html.twig',
            'List/ResultsBuilderTemplate'.self::TWIG_EXTENSION
                => 'Resources/views/'.$this->getBaseGeneratorName().'List/results.html.twig',
            'List/RowBuilderTemplate'.self::TWIG_EXTENSION
                => 'Resources/views/'.$this->getBaseGeneratorName().'List/row.html.twig',
        );
    }
850558
public function hasTemplate($template)
    {
        Deprecated::method(3.3);

        $loader = $this->app['twig']->getLoader();

        /*
         * Twig_ExistsLoaderInterface is getting merged into
         * Twig_LoaderInterface in Twig 2.0. Check for this
         * instead once we are there, and remove getSource() check.
         */
        if ($loader instanceof ExistsLoaderInterface) {
            return $loader->exists($template);
        }

        try {
            $loader->getSource($template);
        } catch (LoaderError $e) {
            return false;
        }

        return true;
    }
601046
protected function templateExists($template)
    {
        if ($this->isBackoffice() || $this->inBackofficeRoot()) {
            $template = '@ClasticBackofficeBundle/Exception/exception_full.html.twig';
        }

        return parent::templateExists($template);
    }
1182862
public function validateTemplate()
    {
        $templates = $this->templates;
        if (!isset($templates[$this->template])) {
            $this->addError('template', 'Invalid template selection.');
        } else {
            $templatePath = $this->templates[$this->template];
            foreach ($this->requiredTemplates() as $template) {
                if (!is_file(Yii::getAlias($templatePath . '/' . $template))) {
                    $this->addError('template', "Unable to find the required code template file '$template'.");
                }
            }
        }
    }
696534
function matches($names)
    {
        //Check every argument supplied
        foreach (func_get_args() as $name)
        {
            //Check for any possible match
            if (
                0 === strcasecmp($name, $this->name) ||
                0 === strcasecmp($name, $this->property->getName()) ||
                0 === strcasecmp($name, Reflection::normalizeProperty($this->property->getName()))
            )
            {
                return true;
            }
        }

        return false;
    }
131358
public function matchRoute()
	{

		//check if this route key exists
		$RouteMatch = (ArrayHelper::KeyExists($this->UrlParserObjectInstance->getController(), $this->definedRoutesArray)->get()) ? true : false;

		//a matching route was found, set params and return true
		if($RouteMatch)
		{
			//set the value of the routeName
			$this->routeName = $this->UrlParserObjectInstance->getController();

			//get metaData for this route
			$this->routeMetaData = $this->definedRoutesArray[$this->UrlParserObjectInstance->getController()];

			//return true
			return true;

		}

		//not matching route was found, return fasle
		else{

			//return false
			return false;

		}

	}
591287
protected function _getTemplate()
    {
        if (is_null($this->_template)) {
            foreach ($this->_map as $method => $className) {
                if ($this->_sql instanceof $className) {
                    $this->_template = $this->$method();
                    break;
                }
            }
        }
        return $this->_template;
    }
508612
public static function ValidExtension()
    {
        $dir = self::GetCwd();

        if(
            // Templates
            is_dir($dir . "/templates") &&
            
            // Peg configuration file
            (file_exists($dir . "/peg.conf") || file_exists($dir . "/peg.json"))
        )
        {
            return true;
        }

        return false;
    }
158224
public function listTemplateNames()
    {
        $this->setUpTemplate();
        $ret = array();
        foreach ($this->templates as $key => $val) {
            $ret[] = $key;
        }
        return $ret;
    }
15361
protected function _getTplName()
    {
        // assign template name
        $sTplName = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('tpl');

        if ($sTplName) {
            // security fix so that you cant access files from outside template dir
            $sTplName = basename($sTplName);

            //checking if it is template name, not content id
            if (!getStr()->preg_match("/\.tpl$/", $sTplName)) {
                $sTplName = null;
            } else {
                $sTplName = 'message/' . $sTplName;
            }
        }

        return $sTplName;
    }
374898
public function checkName () {
        $result = true;

        if ($this->name != preg_replace('/[^a-z0-9_ -]/i', '', $this->name)) {
            $result = false;
        }
        return $result;
    }
99566
public function jsRender()
    {
        $namelessCount = 0;

        $res = preg_replace_callback(
            '/\[[a-z0-9_]*\]|{[a-z0-9_]*}/',
            function ($matches) use (&$namelessCount) {
                $identifier = substr($matches[0], 1, -1);

                // Allow template to contain []
                if ($identifier === '') {
                    $identifier = $namelessCount++;
                }

                if (!isset($this->args[$identifier])) {
                    throw new Exception([
                        'Tag not defined in template for jsExpression',
                        'tag'      => $identifier,
                        'template' => $this->template,
                    ]);
                }

                $value = $this->args[$identifier];

                // No escaping for {}
                if ($matches[0][0] === '{') {
                    return $value;
                }

                if (is_object($value) && $value instanceof jsExpressionable) {
                    $value = '('.$value->jsRender().')';
                } elseif (is_object($value)) {
                    $value = $this->_json_encode($value->toString());
                } else {
                    $value = $this->_json_encode($value);
                }

                return $value;
            },
            $this->template
        );

        return trim($res);
    }
990750
static function isMethodDebugEnabled()
    {
        if ( !isset( $GLOBALS['eZTemplateDebugMethodEnabled'] ) )
        {
            $ini = eZINI::instance();
            $GLOBALS['eZTemplateDebugMethodEnabled'] = $ini->variable( 'TemplateSettings', 'ShowMethodDebug' ) == 'enabled';
        }
        return $GLOBALS['eZTemplateDebugMethodEnabled'];
    }
427578
def template_exists(template_name):
    '''
    
    '''
    try:
        template.loader.get_template(template_name)
        return True
    except template.TemplateDoesNotExist:
        return False
1167781
public function templater()
    {
        if ($this->_templater === null) {
            $class = $this->getConfig('templateClass') ?: 'Cake\View\StringTemplate';
            $this->_templater = new $class();

            $templates = $this->getConfig('templates');
            if ($templates) {
                if (is_string($templates)) {
                    $this->_templater->add($this->_defaultConfig['templates']);
                    $this->_templater->load($templates);
                } else {
                    $this->_templater->add($templates);
                }
            }
        }

        return $this->_templater;
    }