\Twig_Environment
Stores the Twig configuration.
- Author: Fabien Potencier <fabien@symfony.com>
Synopsis
class Twig_Environment
{
- // constants
- const VERSION = '1.13.1';
- // members
- protected $charset;
- protected $loader;
- protected $debug;
- protected $autoReload;
- protected $cache;
- protected $lexer;
- protected $parser;
- protected $compiler;
- protected $baseTemplateClass;
- protected $extensions;
- protected $parsers;
- protected $visitors;
- protected $filters;
- protected $tests;
- protected $functions;
- protected $globals;
- protected $runtimeInitialized;
- protected $extensionInitialized;
- protected $loadedTemplates;
- protected $strictVariables;
- protected $unaryOperators;
- protected $binaryOperators;
- protected string $templateClassPrefix;
- protected $functionCallbacks;
- protected $filterCallbacks;
- protected $staging;
- // methods
- public void __construct()
- public string getBaseTemplateClass()
- public void setBaseTemplateClass()
- public void enableDebug()
- public void disableDebug()
- public Boolean isDebug()
- public void enableAutoReload()
- public void disableAutoReload()
- public Boolean isAutoReload()
- public void enableStrictVariables()
- public void disableStrictVariables()
- public Boolean isStrictVariables()
- public string|false getCache()
- public void setCache()
- public string getCacheFilename()
- public string getTemplateClass()
- public string getTemplateClassPrefix()
- public string render()
- public void display()
- public Twig_TemplateInterface loadTemplate()
- public Boolean isTemplateFresh()
- public void resolveTemplate()
- public void clearTemplateCache()
- public void clearCacheFiles()
- public Twig_LexerInterface getLexer()
- public void setLexer()
- public Twig_TokenStream tokenize()
- public Twig_ParserInterface getParser()
- public void setParser()
- public Twig_Node_Module parse()
- public Twig_CompilerInterface getCompiler()
- public void setCompiler()
- public string compile()
- public string compileSource()
- public void setLoader()
- public Twig_LoaderInterface getLoader()
- public void setCharset()
- public string getCharset()
- public void initRuntime()
- public Boolean hasExtension()
- public Twig_ExtensionInterface getExtension()
- public void addExtension()
- public void removeExtension()
- public void setExtensions()
- public array getExtensions()
- public void addTokenParser()
- public Twig_TokenParserBrokerInterface getTokenParsers()
- public array getTags()
- public void addNodeVisitor()
- public array getNodeVisitors()
- public void addFilter()
- public Twig_Filter|false getFilter()
- public void registerUndefinedFilterCallback()
- public array getFilters()
- public void addTest()
- public array getTests()
- public Twig_Test|false getTest()
- public void addFunction()
- public Twig_Function|false getFunction()
- public void registerUndefinedFunctionCallback()
- public array getFunctions()
- public void addGlobal()
- public array getGlobals()
- public array mergeGlobals()
- public array getUnaryOperators()
- public array getBinaryOperators()
- public void computeAlternatives()
- protected void initGlobals()
- protected void initExtensions()
- protected void initExtension()
- protected void writeCacheFile()
Constants
Name | Value |
---|---|
VERSION | '1.13.1' |
Members
protected
- $autoReload
- $baseTemplateClass
- $binaryOperators
- $cache
- $charset
- $compiler
- $debug
- $extensionInitialized
- $extensions
- $filterCallbacks
- $filters
- $functionCallbacks
- $functions
- $globals
- $lexer
- $loadedTemplates
- $loader
- $parser
- $parsers
- $runtimeInitialized
- $staging
- $strictVariables
- $templateClassPrefix
- $tests
- $unaryOperators
- $visitors
Methods
protected
public
- __construct() — Constructor.
- addExtension() — Registers an extension.
- addFilter() — Registers a Filter.
- addFunction() — Registers a Function.
- addGlobal() — Registers a Global.
- addNodeVisitor() — Registers a Node Visitor.
- addTest() — Registers a Test.
- addTokenParser() — Registers a Token Parser.
- clearCacheFiles() — Clears the template cache files on the filesystem.
- clearTemplateCache() — Clears the internal template cache.
- compile() — Compiles a Node.
- compileSource() — Compiles a template source code.
- computeAlternatives()
- disableAutoReload() — Disables the auto_reload option.
- disableDebug() — Disables debugging mode.
- disableStrictVariables() — Disables the strict_variables option.
- display() — Displays a template.
- enableAutoReload() — Enables the auto_reload option.
- enableDebug() — Enables debugging mode.
- enableStrictVariables() — Enables the strict_variables option.
- getBaseTemplateClass() — Gets the base template class for compiled templates.
- getBinaryOperators() — Gets the registered binary Operators.
- getCache() — Gets the cache directory or false if cache is disabled.
- getCacheFilename() — Gets the cache filename for a given template.
- getCharset() — Gets the default template charset.
- getCompiler() — Gets the Compiler instance.
- getExtension() — Gets an extension by name.
- getExtensions() — Returns all registered extensions.
- getFilter() — Get a filter by name.
- getFilters() — Gets the registered Filters.
- getFunction() — Get a function by name.
- getFunctions() — Gets registered functions.
- getGlobals() — Gets the registered Globals.
- getLexer() — Gets the Lexer instance.
- getLoader() — Gets the Loader instance.
- getNodeVisitors() — Gets the registered Node Visitors.
- getParser() — Gets the Parser instance.
- getTags() — Gets registered tags.
- getTemplateClass() — Gets the template class associated with the given string.
- getTemplateClassPrefix() — Gets the template class prefix.
- getTest() — Gets a test by name.
- getTests() — Gets the registered Tests.
- getTokenParsers() — Gets the registered Token Parsers.
- getUnaryOperators() — Gets the registered unary Operators.
- hasExtension() — Returns true if the given extension is registered.
- initRuntime() — Initializes the runtime environment.
- isAutoReload() — Checks if the auto_reload option is enabled.
- isDebug() — Checks if debug mode is enabled.
- isStrictVariables() — Checks if the strict_variables option is enabled.
- isTemplateFresh() — Returns true if the template is still fresh.
- loadTemplate() — Loads a template by name.
- mergeGlobals() — Merges a context with the defined globals.
- parse() — Parses a token stream.
- registerUndefinedFilterCallback()
- registerUndefinedFunctionCallback()
- removeExtension() — Removes an extension by name.
- render() — Renders a template.
- resolveTemplate()
- setBaseTemplateClass() — Sets the base template class for compiled templates.
- setCache() — Sets the cache directory or false if cache is disabled.
- setCharset() — Sets the default template charset.
- setCompiler() — Sets the Compiler instance.
- setExtensions() — Registers an array of extensions.
- setLexer() — Sets the Lexer instance.
- setLoader() — Sets the Loader instance.
- setParser() — Sets the Parser instance.
- tokenize() — Tokenizes a source code.