ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Twig_Environment Class Reference

Stores the Twig configuration. More...

+ Inheritance diagram for Twig_Environment:
+ Collaboration diagram for Twig_Environment:

Public Member Functions

 __construct (Twig_LoaderInterface $loader=null, $options=array())
 Constructor. More...
 
 getBaseTemplateClass ()
 Gets the base template class for compiled templates. More...
 
 setBaseTemplateClass ($class)
 Sets the base template class for compiled templates. More...
 
 enableDebug ()
 Enables debugging mode. More...
 
 disableDebug ()
 Disables debugging mode. More...
 
 isDebug ()
 Checks if debug mode is enabled. More...
 
 enableAutoReload ()
 Enables the auto_reload option. More...
 
 disableAutoReload ()
 Disables the auto_reload option. More...
 
 isAutoReload ()
 Checks if the auto_reload option is enabled. More...
 
 enableStrictVariables ()
 Enables the strict_variables option. More...
 
 disableStrictVariables ()
 Disables the strict_variables option. More...
 
 isStrictVariables ()
 Checks if the strict_variables option is enabled. More...
 
 getCache ($original=true)
 Gets the current cache implementation. More...
 
 setCache ($cache)
 Sets the current cache implementation. More...
 
 getCacheFilename ($name)
 Gets the cache filename for a given template. More...
 
 getTemplateClass ($name, $index=null)
 Gets the template class associated with the given string. More...
 
 getTemplateClassPrefix ()
 Gets the template class prefix. More...
 
 render ($name, array $context=array())
 Renders a template. More...
 
 display ($name, array $context=array())
 Displays a template. More...
 
 load ($name)
 Loads a template. More...
 
 loadTemplate ($name, $index=null)
 Loads a template internal representation. More...
 
 createTemplate ($template)
 Creates a template from source. More...
 
 isTemplateFresh ($name, $time)
 Returns true if the template is still fresh. More...
 
 resolveTemplate ($names)
 Tries to load a template consecutively from an array. More...
 
 clearTemplateCache ()
 Clears the internal template cache. More...
 
 clearCacheFiles ()
 Clears the template cache files on the filesystem. More...
 
 getLexer ()
 Gets the Lexer instance. More...
 
 setLexer (Twig_LexerInterface $lexer)
 
 tokenize ($source, $name=null)
 Tokenizes a source code. More...
 
 getParser ()
 Gets the Parser instance. More...
 
 setParser (Twig_ParserInterface $parser)
 
 parse (Twig_TokenStream $stream)
 Converts a token stream to a node tree. More...
 
 getCompiler ()
 Gets the Compiler instance. More...
 
 setCompiler (Twig_CompilerInterface $compiler)
 
 compile (Twig_NodeInterface $node)
 Compiles a node and returns the PHP code. More...
 
 compileSource ($source, $name=null)
 Compiles a template source code. More...
 
 setLoader (Twig_LoaderInterface $loader)
 
 getLoader ()
 Gets the Loader instance. More...
 
 setCharset ($charset)
 Sets the default template charset. More...
 
 getCharset ()
 Gets the default template charset. More...
 
 initRuntime ()
 Initializes the runtime environment. More...
 
 hasExtension ($class)
 Returns true if the given extension is registered. More...
 
 addRuntimeLoader (Twig_RuntimeLoaderInterface $loader)
 Adds a runtime loader. More...
 
 getExtension ($class)
 Gets an extension by class name. More...
 
 getRuntime ($class)
 Returns the runtime implementation of a Twig element (filter/function/test). More...
 
 addExtension (Twig_ExtensionInterface $extension)
 
 removeExtension ($name)
 Removes an extension by name. More...
 
 setExtensions (array $extensions)
 Registers an array of extensions. More...
 
 getExtensions ()
 Returns all registered extensions. More...
 
 addTokenParser (Twig_TokenParserInterface $parser)
 
 getTokenParsers ()
 Gets the registered Token Parsers. More...
 
 getTags ()
 Gets registered tags. More...
 
 addNodeVisitor (Twig_NodeVisitorInterface $visitor)
 
 getNodeVisitors ()
 Gets the registered Node Visitors. More...
 
 addFilter ($name, $filter=null)
 Registers a Filter. More...
 
 getFilter ($name)
 Get a filter by name. More...
 
 registerUndefinedFilterCallback ($callable)
 
 getFilters ()
 Gets the registered Filters. More...
 
 addTest ($name, $test=null)
 Registers a Test. More...
 
 getTests ()
 Gets the registered Tests. More...
 
 getTest ($name)
 Gets a test by name. More...
 
 addFunction ($name, $function=null)
 Registers a Function. More...
 
 getFunction ($name)
 Get a function by name. More...
 
 registerUndefinedFunctionCallback ($callable)
 
 getFunctions ()
 Gets registered functions. More...
 
 addGlobal ($name, $value)
 Registers a Global. More...
 
 getGlobals ()
 Gets the registered Globals. More...
 
 mergeGlobals (array $context)
 Merges a context with the defined globals. More...
 
 getUnaryOperators ()
 Gets the registered unary Operators. More...
 
 getBinaryOperators ()
 Gets the registered binary Operators. More...
 
 computeAlternatives ($name, $items)
 

Data Fields

const VERSION = '1.35.3'
 
const VERSION_ID = 13503
 
const MAJOR_VERSION = 1
 
const MINOR_VERSION = 35
 
const RELEASE_VERSION = 3
 
const EXTRA_VERSION = ''
 

Protected Member Functions

 initGlobals ()
 
 initExtensions ()
 
 initExtension (Twig_ExtensionInterface $extension)
 
 writeCacheFile ($file, $content)
 

Protected Attributes

 $charset
 
 $loader
 
 $debug
 
 $autoReload
 
 $cache
 
 $lexer
 
 $parser
 
 $compiler
 
 $baseTemplateClass
 
 $extensions
 
 $parsers
 
 $visitors
 
 $filters
 
 $tests
 
 $functions
 
 $globals
 
 $runtimeInitialized = false
 
 $extensionInitialized = false
 
 $loadedTemplates
 
 $strictVariables
 
 $unaryOperators
 
 $binaryOperators
 
 $templateClassPrefix = '__TwigTemplate_'
 
 $functionCallbacks = array()
 
 $filterCallbacks = array()
 
 $staging
 

Private Member Functions

 updateOptionsHash ()
 

Private Attributes

 $originalCache
 
 $bcWriteCacheFile = false
 
 $bcGetCacheFilename = false
 
 $lastModifiedExtension = 0
 
 $extensionsByClass = array()
 
 $runtimeLoaders = array()
 
 $runtimes = array()
 
 $optionsHash
 
 $loading = array()
 

Detailed Description

Stores the Twig configuration.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 17 of file Environment.php.

Constructor & Destructor Documentation

◆ __construct()

Twig_Environment::__construct ( Twig_LoaderInterface  $loader = null,
  $options = array() 
)

Constructor.

Available options:

  • debug: When set to true, it automatically set "auto_reload" to true as well (default to false).
  • charset: The charset used by the templates (default to UTF-8).
  • base_template_class: The base template class to use for generated templates (default to Twig_Template).
  • cache: An absolute path where to store the compiled templates, a Twig_Cache_Interface implementation, or false to disable compilation cache (default).
  • auto_reload: Whether to reload the template if the original source changed. If you don't provide the auto_reload option, it will be determined automatically based on the debug value.
  • strict_variables: Whether to ignore invalid variables in templates (default to false).
  • autoescape: Whether to enable auto-escaping (default to html):
    • false: disable auto-escaping
    • true: equivalent to html
    • html, js: set the autoescaping to one of the supported strategies
    • name: set the autoescaping strategy based on the template name extension
    • PHP callback: a PHP callback that returns an escaping strategy based on the template "name"
  • optimizations: A flag that indicates which optimizations to apply (default to -1 which means that all optimizations are enabled; set it to 0 to disable).
Parameters
Twig_LoaderInterface$loader
array$optionsAn array of options

Definition at line 101 of file Environment.php.

References $loader, $options, $r, addExtension(), array, setCache(), and setLoader().

102  {
103  if (null !== $loader) {
104  $this->setLoader($loader);
105  } else {
106  @trigger_error('Not passing a Twig_LoaderInterface as the first constructor argument of Twig_Environment is deprecated since version 1.21.', E_USER_DEPRECATED);
107  }
108 
109  $options = array_merge(array(
110  'debug' => false,
111  'charset' => 'UTF-8',
112  'base_template_class' => 'Twig_Template',
113  'strict_variables' => false,
114  'autoescape' => 'html',
115  'cache' => false,
116  'auto_reload' => null,
117  'optimizations' => -1,
118  ), $options);
119 
120  $this->debug = (bool) $options['debug'];
121  $this->charset = strtoupper($options['charset']);
122  $this->baseTemplateClass = $options['base_template_class'];
123  $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload'];
124  $this->strictVariables = (bool) $options['strict_variables'];
125  $this->setCache($options['cache']);
126 
127  $this->addExtension(new Twig_Extension_Core());
128  $this->addExtension(new Twig_Extension_Escaper($options['autoescape']));
129  $this->addExtension(new Twig_Extension_Optimizer($options['optimizations']));
130  $this->staging = new Twig_Extension_Staging();
131 
132  // For BC
133  if (is_string($this->originalCache)) {
134  $r = new ReflectionMethod($this, 'writeCacheFile');
135  if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
136  @trigger_error('The Twig_Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
137 
138  $this->bcWriteCacheFile = true;
139  }
140 
141  $r = new ReflectionMethod($this, 'getCacheFilename');
142  if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
143  @trigger_error('The Twig_Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
144 
145  $this->bcGetCacheFilename = true;
146  }
147  }
148  }
addExtension(Twig_ExtensionInterface $extension)
$r
Definition: example_031.php:79
setLoader(Twig_LoaderInterface $loader)
Create styles array
The data for the language used.
setCache($cache)
Sets the current cache implementation.
Internal class.
Definition: Staging.php:21
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:

Member Function Documentation

◆ addExtension()

Twig_Environment::addExtension ( Twig_ExtensionInterface  $extension)

Definition at line 938 of file Environment.php.

References Twig_ExtensionInterface\getName(), and updateOptionsHash().

Referenced by __construct(), and setExtensions().

939  {
940  if ($this->extensionInitialized) {
941  throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName()));
942  }
943 
944  $class = get_class($extension);
945  if ($class !== $extension->getName()) {
946  if (isset($this->extensions[$extension->getName()])) {
947  unset($this->extensions[$extension->getName()], $this->extensionsByClass[$class]);
948  @trigger_error(sprintf('The possibility to register the same extension twice ("%s") is deprecated since version 1.23 and will be removed in Twig 2.0. Use proper PHP inheritance instead.', $extension->getName()), E_USER_DEPRECATED);
949  }
950  }
951 
952  $this->lastModifiedExtension = 0;
953  $this->extensionsByClass[$class] = $extension;
954  $this->extensions[$extension->getName()] = $extension;
955  $this->updateOptionsHash();
956  }
getName()
Returns the name of the extension.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFilter()

Twig_Environment::addFilter (   $name,
  $filter = null 
)

Registers a Filter.

Parameters
string | Twig_SimpleFilter$nameThe filter name or a Twig_SimpleFilter instance
Twig_FilterInterface | Twig_SimpleFilter$filter

Definition at line 1093 of file Environment.php.

References $name.

1094  {
1095  if (!$name instanceof Twig_SimpleFilter && !($filter instanceof Twig_SimpleFilter || $filter instanceof Twig_FilterInterface)) {
1096  throw new LogicException('A filter must be an instance of Twig_FilterInterface or Twig_SimpleFilter.');
1097  }
1098 
1099  if ($name instanceof Twig_SimpleFilter) {
1100  $filter = $name;
1101  $name = $filter->getName();
1102  } else {
1103  @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFilter" instead when defining filter "%s".', __METHOD__, $name), E_USER_DEPRECATED);
1104  }
1105 
1106  if ($this->extensionInitialized) {
1107  throw new LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $name));
1108  }
1109 
1110  $this->staging->addFilter($name, $filter);
1111  }
Represents a template filter.
Represents a template filter.
if($format !==null) $name
Definition: metadata.php:146

◆ addFunction()

Twig_Environment::addFunction (   $name,
  $function = null 
)

Registers a Function.

Parameters
string | Twig_SimpleFunction$nameThe function name or a Twig_SimpleFunction instance
Twig_FunctionInterface | Twig_SimpleFunction$function

Definition at line 1252 of file Environment.php.

References $function, and $name.

1253  {
1254  if (!$name instanceof Twig_SimpleFunction && !($function instanceof Twig_SimpleFunction || $function instanceof Twig_FunctionInterface)) {
1255  throw new LogicException('A function must be an instance of Twig_FunctionInterface or Twig_SimpleFunction.');
1256  }
1257 
1258  if ($name instanceof Twig_SimpleFunction) {
1259  $function = $name;
1260  $name = $function->getName();
1261  } else {
1262  @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFunction" instead when defining function "%s".', __METHOD__, $name), E_USER_DEPRECATED);
1263  }
1264 
1265  if ($this->extensionInitialized) {
1266  throw new LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $name));
1267  }
1268 
1269  $this->staging->addFunction($name, $function);
1270  }
Represents a template function.
if($format !==null) $name
Definition: metadata.php:146
Represents a template function.
$function
Definition: cas.php:28

◆ addGlobal()

Twig_Environment::addGlobal (   $name,
  $value 
)

Registers a Global.

New globals can be added before compiling or rendering a template; but after, you can only update existing globals.

Parameters
string$nameThe global name
mixed$valueThe global value

Definition at line 1350 of file Environment.php.

References $name, and initGlobals().

1351  {
1352  if ($this->extensionInitialized || $this->runtimeInitialized) {
1353  if (null === $this->globals) {
1354  $this->globals = $this->initGlobals();
1355  }
1356 
1357  if (!array_key_exists($name, $this->globals)) {
1358  // The deprecation notice must be turned into the following exception in Twig 2.0
1359  @trigger_error(sprintf('Registering global variable "%s" at runtime or when the extensions have already been initialized is deprecated since version 1.21.', $name), E_USER_DEPRECATED);
1360  //throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name));
1361  }
1362  }
1363 
1364  if ($this->extensionInitialized || $this->runtimeInitialized) {
1365  // update the value
1366  $this->globals[$name] = $value;
1367  } else {
1368  $this->staging->addGlobal($name, $value);
1369  }
1370  }
if($format !==null) $name
Definition: metadata.php:146
+ Here is the call graph for this function:

◆ addNodeVisitor()

Twig_Environment::addNodeVisitor ( Twig_NodeVisitorInterface  $visitor)

Definition at line 1062 of file Environment.php.

1063  {
1064  if ($this->extensionInitialized) {
1065  throw new LogicException('Unable to add a node visitor as extensions have already been initialized.');
1066  }
1067 
1068  $this->staging->addNodeVisitor($visitor);
1069  }

◆ addRuntimeLoader()

Twig_Environment::addRuntimeLoader ( Twig_RuntimeLoaderInterface  $loader)

Adds a runtime loader.

Definition at line 878 of file Environment.php.

References $loader.

879  {
880  $this->runtimeLoaders[] = $loader;
881  }

◆ addTest()

Twig_Environment::addTest (   $name,
  $test = null 
)

Registers a Test.

Parameters
string | Twig_SimpleTest$nameThe test name or a Twig_SimpleTest instance
Twig_TestInterface | Twig_SimpleTest$testA Twig_TestInterface instance or a Twig_SimpleTest instance

Definition at line 1188 of file Environment.php.

References $name, and $test.

1189  {
1190  if (!$name instanceof Twig_SimpleTest && !($test instanceof Twig_SimpleTest || $test instanceof Twig_TestInterface)) {
1191  throw new LogicException('A test must be an instance of Twig_TestInterface or Twig_SimpleTest.');
1192  }
1193 
1194  if ($name instanceof Twig_SimpleTest) {
1195  $test = $name;
1196  $name = $test->getName();
1197  } else {
1198  @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleTest" instead when defining test "%s".', __METHOD__, $name), E_USER_DEPRECATED);
1199  }
1200 
1201  if ($this->extensionInitialized) {
1202  throw new LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $name));
1203  }
1204 
1205  $this->staging->addTest($name, $test);
1206  }
Represents a template test.
if($format !==null) $name
Definition: metadata.php:146
Represents a template test.
Definition: SimpleTest.php:19
$test
Definition: Utf8Test.php:84

◆ addTokenParser()

Twig_Environment::addTokenParser ( Twig_TokenParserInterface  $parser)

Definition at line 1016 of file Environment.php.

1017  {
1018  if ($this->extensionInitialized) {
1019  throw new LogicException('Unable to add a token parser as extensions have already been initialized.');
1020  }
1021 
1022  $this->staging->addTokenParser($parser);
1023  }

◆ clearCacheFiles()

Twig_Environment::clearCacheFiles ( )

Clears the template cache files on the filesystem.

Deprecated:
since 1.22 (to be removed in 2.0)

Definition at line 620 of file Environment.php.

References $file.

621  {
622  @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
623 
624  if (is_string($this->originalCache)) {
625  foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->originalCache), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
626  if ($file->isFile()) {
627  @unlink($file->getPathname());
628  }
629  }
630  }
631  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file

◆ clearTemplateCache()

Twig_Environment::clearTemplateCache ( )

Clears the internal template cache.

Deprecated:
since 1.18.3 (to be removed in 2.0)

Definition at line 608 of file Environment.php.

References array.

609  {
610  @trigger_error(sprintf('The %s method is deprecated since version 1.18.3 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
611 
612  $this->loadedTemplates = array();
613  }
Create styles array
The data for the language used.

◆ compile()

Twig_Environment::compile ( Twig_NodeInterface  $node)

Compiles a node and returns the PHP code.

Returns
string The compiled PHP source code

Definition at line 747 of file Environment.php.

Referenced by compileSource().

748  {
749  if (null === $this->compiler) {
750  $this->compiler = new Twig_Compiler($this);
751  }
752 
753  return $this->compiler->compile($node)->getSource();
754  }
+ Here is the caller graph for this function:

◆ compileSource()

Twig_Environment::compileSource (   $source,
  $name = null 
)

Compiles a template source code.

Parameters
string | Twig_Source$sourceThe template source code
string$nameThe template name (deprecated)
Returns
string The compiled PHP source code
Exceptions
Twig_Error_SyntaxWhen there was an error during tokenizing, parsing or compiling

Definition at line 766 of file Environment.php.

References $name, $source, compile(), parse(), Twig_Error\setSourceContext(), and tokenize().

Referenced by loadTemplate().

767  {
768  if (!$source instanceof Twig_Source) {
769  @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
770  $source = new Twig_Source($source, $name);
771  }
772 
773  try {
774  return $this->compile($this->parse($this->tokenize($source)));
775  } catch (Twig_Error $e) {
777  throw $e;
778  } catch (Exception $e) {
779  throw new Twig_Error_Syntax(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e);
780  }
781  }
setSourceContext(Twig_Source $source=null)
Sets the source context of the Twig template where the error occurred.
Definition: Error.php:199
Twig base exception.
Definition: Error.php:34
Exception thrown when a syntax error occurs during lexing or parsing of a template.
Definition: Syntax.php:18
if($format !==null) $name
Definition: metadata.php:146
tokenize($source, $name=null)
Tokenizes a source code.
parse(Twig_TokenStream $stream)
Converts a token stream to a node tree.
Holds information about a non-compiled Twig template.
Definition: Source.php:19
compile(Twig_NodeInterface $node)
Compiles a node and returns the PHP code.
$source
Definition: linkback.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ computeAlternatives()

Twig_Environment::computeAlternatives (   $name,
  $items 
)
Deprecated:
since 1.23 (to be removed in 2.0)

Definition at line 1447 of file Environment.php.

References $name, and Twig_Error_Syntax\computeAlternatives().

1448  {
1449  @trigger_error(sprintf('The %s method is deprecated since version 1.23 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
1450 
1452  }
static computeAlternatives($name, $items)
Definition: Syntax.php:40
if($format !==null) $name
Definition: metadata.php:146
+ Here is the call graph for this function:

◆ createTemplate()

Twig_Environment::createTemplate (   $template)

Creates a template from source.

This method should not be used as a generic way to load templates.

Parameters
string$templateThe template name
Returns
Twig_Template A template instance representing the given template name
Exceptions
Twig_Error_LoaderWhen the template cannot be found
Twig_Error_SyntaxWhen an error occurred during compilation

Definition at line 510 of file Environment.php.

References $current, $loader, $name, $template, array, getLoader(), GuzzleHttp\Psr7\hash(), loadTemplate(), and setLoader().

Referenced by twig_template_from_string().

511  {
512  $name = sprintf('__string_template__%s', hash('sha256', $template, false));
513 
516  $current = $this->getLoader(),
517  ));
518 
519  $this->setLoader($loader);
520  try {
521  $template = $this->loadTemplate($name);
522  } catch (Exception $e) {
523  $this->setLoader($current);
524 
525  throw $e;
526  } catch (Throwable $e) {
527  $this->setLoader($current);
528 
529  throw $e;
530  }
531  $this->setLoader($current);
532 
533  return $template;
534  }
$template
getLoader()
Gets the Loader instance.
if($format !==null) $name
Definition: metadata.php:146
setLoader(Twig_LoaderInterface $loader)
Loads templates from other loaders.
Definition: Chain.php:19
Create styles array
The data for the language used.
loadTemplate($name, $index=null)
Loads a template internal representation.
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
Definition: functions.php:406
Loads a template from an array.
Definition: Array.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disableAutoReload()

Twig_Environment::disableAutoReload ( )

Disables the auto_reload option.

Definition at line 210 of file Environment.php.

211  {
212  $this->autoReload = false;
213  }

◆ disableDebug()

Twig_Environment::disableDebug ( )

Disables debugging mode.

Definition at line 183 of file Environment.php.

References updateOptionsHash().

184  {
185  $this->debug = false;
186  $this->updateOptionsHash();
187  }
+ Here is the call graph for this function:

◆ disableStrictVariables()

Twig_Environment::disableStrictVariables ( )

Disables the strict_variables option.

Definition at line 237 of file Environment.php.

References updateOptionsHash().

238  {
239  $this->strictVariables = false;
240  $this->updateOptionsHash();
241  }
+ Here is the call graph for this function:

◆ display()

Twig_Environment::display (   $name,
array  $context = array() 
)

Displays a template.

Parameters
string$nameThe template name
array$contextAn array of parameters to pass to the template
Exceptions
Twig_Error_LoaderWhen the template cannot be found
Twig_Error_SyntaxWhen an error occurred during compilation
Twig_Error_RuntimeWhen an error occurred during rendering

Definition at line 376 of file Environment.php.

References $name, and loadTemplate().

377  {
378  $this->loadTemplate($name)->display($context);
379  }
if($format !==null) $name
Definition: metadata.php:146
loadTemplate($name, $index=null)
Loads a template internal representation.
+ Here is the call graph for this function:

◆ enableAutoReload()

Twig_Environment::enableAutoReload ( )

Enables the auto_reload option.

Definition at line 202 of file Environment.php.

203  {
204  $this->autoReload = true;
205  }

◆ enableDebug()

Twig_Environment::enableDebug ( )

Enables debugging mode.

Definition at line 174 of file Environment.php.

References updateOptionsHash().

175  {
176  $this->debug = true;
177  $this->updateOptionsHash();
178  }
+ Here is the call graph for this function:

◆ enableStrictVariables()

Twig_Environment::enableStrictVariables ( )

Enables the strict_variables option.

Definition at line 228 of file Environment.php.

References updateOptionsHash().

229  {
230  $this->strictVariables = true;
231  $this->updateOptionsHash();
232  }
+ Here is the call graph for this function:

◆ getBaseTemplateClass()

Twig_Environment::getBaseTemplateClass ( )

Gets the base template class for compiled templates.

Returns
string The base template class name

Definition at line 155 of file Environment.php.

References $baseTemplateClass.

156  {
158  }

◆ getBinaryOperators()

Twig_Environment::getBinaryOperators ( )

Gets the registered binary Operators.

Returns
array An array of binary operators

Definition at line 1435 of file Environment.php.

References $binaryOperators, and initExtensions().

1436  {
1437  if (!$this->extensionInitialized) {
1438  $this->initExtensions();
1439  }
1440 
1441  return $this->binaryOperators;
1442  }
+ Here is the call graph for this function:

◆ getCache()

Twig_Environment::getCache (   $original = true)

Gets the current cache implementation.

Parameters
bool$originalWhether to return the original cache option or the real cache instance
Returns
Twig_CacheInterface|string|false A Twig_CacheInterface implementation, an absolute path to the compiled templates, or false to disable cache

Definition at line 262 of file Environment.php.

References $cache.

263  {
264  return $original ? $this->originalCache : $this->cache;
265  }

◆ getCacheFilename()

Twig_Environment::getCacheFilename (   $name)

Gets the cache filename for a given template.

Parameters
string$nameThe template name
Returns
string|false The cache file name or false when caching is disabled
Deprecated:
since 1.22 (to be removed in 2.0)

Definition at line 302 of file Environment.php.

References $key, $name, and getTemplateClass().

Referenced by loadTemplate().

303  {
304  @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
305 
306  $key = $this->cache->generateKey($name, $this->getTemplateClass($name));
307 
308  return !$key ? false : $key;
309  }
getTemplateClass($name, $index=null)
Gets the template class associated with the given string.
if($format !==null) $name
Definition: metadata.php:146
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCharset()

Twig_Environment::getCharset ( )

Gets the default template charset.

Returns
string The default charset

Definition at line 821 of file Environment.php.

References $charset.

Referenced by Twig_Extensions_Extension_Text\getName(), and twig_random().

822  {
823  return $this->charset;
824  }
+ Here is the caller graph for this function:

◆ getCompiler()

Twig_Environment::getCompiler ( )

Gets the Compiler instance.

Returns
Twig_CompilerInterface
Deprecated:
since 1.25 (to be removed in 2.0)

Definition at line 726 of file Environment.php.

References $compiler.

727  {
728  @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
729 
730  if (null === $this->compiler) {
731  $this->compiler = new Twig_Compiler($this);
732  }
733 
734  return $this->compiler;
735  }

◆ getExtension()

Twig_Environment::getExtension (   $class)

Gets an extension by class name.

Parameters
string$classThe extension class name
Returns
Twig_ExtensionInterface

Definition at line 890 of file Environment.php.

Referenced by Twig_NodeVisitor_Escaper\doEnterNode(), twig_date_converter(), twig_date_format_filter(), and twig_number_format_filter().

891  {
892  $class = ltrim($class, '\\');
893  if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) {
894  // For BC/FC with namespaced aliases
895  $class = new ReflectionClass($class);
896  $class = $class->name;
897  }
898 
899  if (isset($this->extensions[$class])) {
900  if ($class !== get_class($this->extensions[$class])) {
901  @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED);
902  }
903 
904  return $this->extensions[$class];
905  }
906 
907  if (!isset($this->extensionsByClass[$class])) {
908  throw new Twig_Error_Runtime(sprintf('The "%s" extension is not enabled.', $class));
909  }
910 
911  return $this->extensionsByClass[$class];
912  }
Exception thrown when an error occurs at runtime.
Definition: Runtime.php:18
+ Here is the caller graph for this function:

◆ getExtensions()

Twig_Environment::getExtensions ( )

Returns all registered extensions.

Returns
Twig_ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on)

Definition at line 1011 of file Environment.php.

References $extensions.

Referenced by initRuntime().

1012  {
1013  return $this->extensions;
1014  }
+ Here is the caller graph for this function:

◆ getFilter()

Twig_Environment::getFilter (   $name)

Get a filter by name.

Subclasses may override this method and load filters differently; so no list of filters is available.

Parameters
string$nameThe filter name
Returns
Twig_Filter|false A Twig_Filter instance or false if the filter does not exist

Definition at line 1125 of file Environment.php.

References $name, and initExtensions().

Referenced by Twig_NodeVisitor_SafeAnalysis\doLeaveNode(), and Twig_NodeVisitor_Escaper\preEscapeFilterNode().

1126  {
1127  if (!$this->extensionInitialized) {
1128  $this->initExtensions();
1129  }
1130 
1131  if (isset($this->filters[$name])) {
1132  return $this->filters[$name];
1133  }
1134 
1135  foreach ($this->filters as $pattern => $filter) {
1136  $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count);
1137 
1138  if ($count) {
1139  if (preg_match('#^'.$pattern.'$#', $name, $matches)) {
1140  array_shift($matches);
1141  $filter->setArguments($matches);
1142 
1143  return $filter;
1144  }
1145  }
1146  }
1147 
1148  foreach ($this->filterCallbacks as $callback) {
1149  if (false !== $filter = call_user_func($callback, $name)) {
1150  return $filter;
1151  }
1152  }
1153 
1154  return false;
1155  }
if($format !==null) $name
Definition: metadata.php:146
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilters()

Twig_Environment::getFilters ( )

Gets the registered Filters.

Be warned that this method cannot return filters defined with registerUndefinedFilterCallback.

Returns
Twig_FilterInterface[]
See also
registerUndefinedFilterCallback

Definition at line 1173 of file Environment.php.

References $filters, and initExtensions().

1174  {
1175  if (!$this->extensionInitialized) {
1176  $this->initExtensions();
1177  }
1178 
1179  return $this->filters;
1180  }
+ Here is the call graph for this function:

◆ getFunction()

Twig_Environment::getFunction (   $name)

Get a function by name.

Subclasses may override this method and load functions differently; so no list of functions is available.

Parameters
string$namefunction name
Returns
Twig_Function|false A Twig_Function instance or false if the function does not exist

Definition at line 1284 of file Environment.php.

References $function, $name, functions, and initExtensions().

Referenced by Twig_NodeVisitor_SafeAnalysis\doLeaveNode().

1285  {
1286  if (!$this->extensionInitialized) {
1287  $this->initExtensions();
1288  }
1289 
1290  if (isset($this->functions[$name])) {
1291  return $this->functions[$name];
1292  }
1293 
1294  foreach ($this->functions as $pattern => $function) {
1295  $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count);
1296 
1297  if ($count) {
1298  if (preg_match('#^'.$pattern.'$#', $name, $matches)) {
1299  array_shift($matches);
1300  $function->setArguments($matches);
1301 
1302  return $function;
1303  }
1304  }
1305  }
1306 
1307  foreach ($this->functionCallbacks as $callback) {
1308  if (false !== $function = call_user_func($callback, $name)) {
1309  return $function;
1310  }
1311  }
1312 
1313  return false;
1314  }
List implemented functions
if($format !==null) $name
Definition: metadata.php:146
$function
Definition: cas.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFunctions()

Twig_Environment::getFunctions ( )

Gets registered functions.

Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback.

Returns
Twig_FunctionInterface[]
See also
registerUndefinedFunctionCallback

Definition at line 1332 of file Environment.php.

References $functions, and initExtensions().

1333  {
1334  if (!$this->extensionInitialized) {
1335  $this->initExtensions();
1336  }
1337 
1338  return $this->functions;
1339  }
+ Here is the call graph for this function:

◆ getGlobals()

Twig_Environment::getGlobals ( )

Gets the registered Globals.

Returns
array An array of globals

Definition at line 1379 of file Environment.php.

References $globals, and initGlobals().

Referenced by mergeGlobals().

1380  {
1381  if (!$this->runtimeInitialized && !$this->extensionInitialized) {
1382  return $this->initGlobals();
1383  }
1384 
1385  if (null === $this->globals) {
1386  $this->globals = $this->initGlobals();
1387  }
1388 
1389  return $this->globals;
1390  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLexer()

Twig_Environment::getLexer ( )

Gets the Lexer instance.

Returns
Twig_LexerInterface
Deprecated:
since 1.25 (to be removed in 2.0)

Definition at line 640 of file Environment.php.

References $lexer.

641  {
642  @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
643 
644  if (null === $this->lexer) {
645  $this->lexer = new Twig_Lexer($this);
646  }
647 
648  return $this->lexer;
649  }
Lexes a template string.
Definition: Lexer.php:18

◆ getLoader()

Twig_Environment::getLoader ( )

Gets the Loader instance.

Returns
Twig_LoaderInterface

Definition at line 797 of file Environment.php.

References $loader.

Referenced by createTemplate(), getTemplateClass(), isTemplateFresh(), and loadTemplate().

798  {
799  if (null === $this->loader) {
800  throw new LogicException('You must set a loader first.');
801  }
802 
803  return $this->loader;
804  }
+ Here is the caller graph for this function:

◆ getNodeVisitors()

Twig_Environment::getNodeVisitors ( )

Gets the registered Node Visitors.

Returns
Twig_NodeVisitorInterface[]

Definition at line 1078 of file Environment.php.

References $visitors, and initExtensions().

1079  {
1080  if (!$this->extensionInitialized) {
1081  $this->initExtensions();
1082  }
1083 
1084  return $this->visitors;
1085  }
+ Here is the call graph for this function:

◆ getParser()

Twig_Environment::getParser ( )

Gets the Parser instance.

Returns
Twig_ParserInterface
Deprecated:
since 1.25 (to be removed in 2.0)

Definition at line 687 of file Environment.php.

References $parser.

688  {
689  @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
690 
691  if (null === $this->parser) {
692  $this->parser = new Twig_Parser($this);
693  }
694 
695  return $this->parser;
696  }
Default parser implementation.
Definition: Parser.php:18

◆ getRuntime()

Twig_Environment::getRuntime (   $class)

Returns the runtime implementation of a Twig element (filter/function/test).

Parameters
string$classA runtime class name
Returns
object The runtime implementation
Exceptions
Twig_Error_RuntimeWhen the template cannot be found

Definition at line 923 of file Environment.php.

References $loader.

924  {
925  if (isset($this->runtimes[$class])) {
926  return $this->runtimes[$class];
927  }
928 
929  foreach ($this->runtimeLoaders as $loader) {
930  if (null !== $runtime = $loader->load($class)) {
931  return $this->runtimes[$class] = $runtime;
932  }
933  }
934 
935  throw new Twig_Error_Runtime(sprintf('Unable to load the "%s" runtime.', $class));
936  }
Exception thrown when an error occurs at runtime.
Definition: Runtime.php:18

◆ getTags()

Twig_Environment::getTags ( )

Gets registered tags.

Be warned that this method cannot return tags defined by Twig_TokenParserBrokerInterface classes.

Returns
Twig_TokenParserInterface[]

Definition at line 1050 of file Environment.php.

References $parser, $tags, array, and getTokenParsers().

1051  {
1052  $tags = array();
1053  foreach ($this->getTokenParsers()->getParsers() as $parser) {
1054  if ($parser instanceof Twig_TokenParserInterface) {
1055  $tags[$parser->getTag()] = $parser;
1056  }
1057  }
1058 
1059  return $tags;
1060  }
$tags
Definition: croninfo.php:19
Create styles array
The data for the language used.
getTokenParsers()
Gets the registered Token Parsers.
Interface implemented by token parsers.
+ Here is the call graph for this function:

◆ getTemplateClass()

Twig_Environment::getTemplateClass (   $name,
  $index = null 
)

Gets the template class associated with the given string.

The generated template class is based on the following parameters:

  • The cache key for the given template;
  • The currently enabled extensions;
  • Whether the Twig C extension is available or not;
  • PHP version;
  • Twig version;
  • Options with what environment was created.
Parameters
string$nameThe name for which to calculate the template class name
int | null$indexThe index if it is an embedded template
Returns
string The template class name

Definition at line 328 of file Environment.php.

References $index, $key, $name, and getLoader().

Referenced by getCacheFilename(), and loadTemplate().

329  {
330  $key = $this->getLoader()->getCacheKey($name).$this->optionsHash;
331 
332  return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index);
333  }
$index
Definition: metadata.php:60
getLoader()
Gets the Loader instance.
if($format !==null) $name
Definition: metadata.php:146
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplateClassPrefix()

Twig_Environment::getTemplateClassPrefix ( )

Gets the template class prefix.

Returns
string The template class prefix
Deprecated:
since 1.22 (to be removed in 2.0)

Definition at line 342 of file Environment.php.

References $templateClassPrefix.

343  {
344  @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
345 
347  }

◆ getTest()

Twig_Environment::getTest (   $name)

Gets a test by name.

Parameters
string$nameThe test name
Returns
Twig_Test|false A Twig_Test instance or false if the test does not exist

Definition at line 1233 of file Environment.php.

References $name, and initExtensions().

1234  {
1235  if (!$this->extensionInitialized) {
1236  $this->initExtensions();
1237  }
1238 
1239  if (isset($this->tests[$name])) {
1240  return $this->tests[$name];
1241  }
1242 
1243  return false;
1244  }
if($format !==null) $name
Definition: metadata.php:146
+ Here is the call graph for this function:

◆ getTests()

Twig_Environment::getTests ( )

Gets the registered Tests.

Returns
Twig_TestInterface[]

Definition at line 1215 of file Environment.php.

References $tests, and initExtensions().

1216  {
1217  if (!$this->extensionInitialized) {
1218  $this->initExtensions();
1219  }
1220 
1221  return $this->tests;
1222  }
+ Here is the call graph for this function:

◆ getTokenParsers()

Twig_Environment::getTokenParsers ( )

Gets the registered Token Parsers.

Returns
Twig_TokenParserBrokerInterface

Definition at line 1032 of file Environment.php.

References $parsers, and initExtensions().

Referenced by getTags().

1033  {
1034  if (!$this->extensionInitialized) {
1035  $this->initExtensions();
1036  }
1037 
1038  return $this->parsers;
1039  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUnaryOperators()

Twig_Environment::getUnaryOperators ( )

Gets the registered unary Operators.

Returns
array An array of unary operators

Definition at line 1419 of file Environment.php.

References $unaryOperators, and initExtensions().

1420  {
1421  if (!$this->extensionInitialized) {
1422  $this->initExtensions();
1423  }
1424 
1425  return $this->unaryOperators;
1426  }
+ Here is the call graph for this function:

◆ hasExtension()

Twig_Environment::hasExtension (   $class)

Returns true if the given extension is registered.

Parameters
string$classThe extension class name
Returns
bool Whether the extension is registered or not

Definition at line 855 of file Environment.php.

Referenced by Twig_NodeVisitor_Escaper\doEnterNode(), Twig_NodeVisitor_Optimizer\doEnterNode(), and Twig_NodeVisitor_Optimizer\doLeaveNode().

856  {
857  $class = ltrim($class, '\\');
858  if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) {
859  // For BC/FC with namespaced aliases
860  $class = new ReflectionClass($class);
861  $class = $class->name;
862  }
863 
864  if (isset($this->extensions[$class])) {
865  if ($class !== get_class($this->extensions[$class])) {
866  @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED);
867  }
868 
869  return true;
870  }
871 
872  return isset($this->extensionsByClass[$class]);
873  }
+ Here is the caller graph for this function:

◆ initExtension()

Twig_Environment::initExtension ( Twig_ExtensionInterface  $extension)
protected

Definition at line 1510 of file Environment.php.

References $function, $name, $parser, $test, functions, Twig_ExtensionInterface\getFilters(), Twig_ExtensionInterface\getFunctions(), Twig_ExtensionInterface\getNodeVisitors(), Twig_ExtensionInterface\getOperators(), Twig_ExtensionInterface\getTests(), and Twig_ExtensionInterface\getTokenParsers().

Referenced by initExtensions().

1511  {
1512  // filters
1513  foreach ($extension->getFilters() as $name => $filter) {
1514  if ($filter instanceof Twig_SimpleFilter) {
1515  $name = $filter->getName();
1516  } else {
1517  @trigger_error(sprintf('Using an instance of "%s" for filter "%s" is deprecated since version 1.21. Use Twig_SimpleFilter instead.', get_class($filter), $name), E_USER_DEPRECATED);
1518  }
1519 
1520  $this->filters[$name] = $filter;
1521  }
1522 
1523  // functions
1524  foreach ($extension->getFunctions() as $name => $function) {
1525  if ($function instanceof Twig_SimpleFunction) {
1526  $name = $function->getName();
1527  } else {
1528  @trigger_error(sprintf('Using an instance of "%s" for function "%s" is deprecated since version 1.21. Use Twig_SimpleFunction instead.', get_class($function), $name), E_USER_DEPRECATED);
1529  }
1530 
1531  $this->functions[$name] = $function;
1532  }
1533 
1534  // tests
1535  foreach ($extension->getTests() as $name => $test) {
1536  if ($test instanceof Twig_SimpleTest) {
1537  $name = $test->getName();
1538  } else {
1539  @trigger_error(sprintf('Using an instance of "%s" for test "%s" is deprecated since version 1.21. Use Twig_SimpleTest instead.', get_class($test), $name), E_USER_DEPRECATED);
1540  }
1541 
1542  $this->tests[$name] = $test;
1543  }
1544 
1545  // token parsers
1546  foreach ($extension->getTokenParsers() as $parser) {
1547  if ($parser instanceof Twig_TokenParserInterface) {
1548  $this->parsers->addTokenParser($parser);
1549  } elseif ($parser instanceof Twig_TokenParserBrokerInterface) {
1550  @trigger_error('Registering a Twig_TokenParserBrokerInterface instance is deprecated since version 1.21.', E_USER_DEPRECATED);
1551 
1552  $this->parsers->addTokenParserBroker($parser);
1553  } else {
1554  throw new LogicException('getTokenParsers() must return an array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances.');
1555  }
1556  }
1557 
1558  // node visitors
1559  foreach ($extension->getNodeVisitors() as $visitor) {
1560  $this->visitors[] = $visitor;
1561  }
1562 
1563  // operators
1564  if ($operators = $extension->getOperators()) {
1565  if (!is_array($operators)) {
1566  throw new InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', get_class($extension), is_object($operators) ? get_class($operators) : gettype($operators).(is_resource($operators) ? '' : '#'.$operators)));
1567  }
1568 
1569  if (2 !== count($operators)) {
1570  throw new InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', get_class($extension), count($operators)));
1571  }
1572 
1573  $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]);
1574  $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]);
1575  }
1576  }
Interface implemented by token parser brokers.
Represents a template function.
List implemented functions
getNodeVisitors()
Returns the node visitor instances to add to the existing list.
Represents a template filter.
if($format !==null) $name
Definition: metadata.php:146
getFunctions()
Returns a list of functions to add to the existing list.
getOperators()
Returns a list of operators to add to the existing list.
getTests()
Returns a list of tests to add to the existing list.
getTokenParsers()
Returns the token parser instances to add to the existing list.
getFilters()
Returns a list of filters to add to the existing list.
Interface implemented by token parsers.
$function
Definition: cas.php:28
Represents a template test.
Definition: SimpleTest.php:19
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initExtensions()

Twig_Environment::initExtensions ( )
protected

Definition at line 1485 of file Environment.php.

References array, functions, and initExtension().

Referenced by getBinaryOperators(), getFilter(), getFilters(), getFunction(), getFunctions(), getNodeVisitors(), getTest(), getTests(), getTokenParsers(), and getUnaryOperators().

1486  {
1487  if ($this->extensionInitialized) {
1488  return;
1489  }
1490 
1491  $this->parsers = new Twig_TokenParserBroker(array(), array(), false);
1492  $this->filters = array();
1493  $this->functions = array();
1494  $this->tests = array();
1495  $this->visitors = array();
1496  $this->unaryOperators = array();
1497  $this->binaryOperators = array();
1498 
1499  foreach ($this->extensions as $extension) {
1500  $this->initExtension($extension);
1501  }
1502  $this->initExtension($this->staging);
1503  // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception
1504  $this->extensionInitialized = true;
1505  }
List implemented functions
Create styles array
The data for the language used.
initExtension(Twig_ExtensionInterface $extension)
Default implementation of a token parser broker.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initGlobals()

Twig_Environment::initGlobals ( )
protected

Definition at line 1457 of file Environment.php.

References $globals, $m, $name, and array.

Referenced by addGlobal(), and getGlobals().

1458  {
1459  $globals = array();
1460  foreach ($this->extensions as $name => $extension) {
1461  if (!$extension instanceof Twig_Extension_GlobalsInterface) {
1462  $m = new ReflectionMethod($extension, 'getGlobals');
1463 
1464  if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) {
1465  @trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension without explicitly implementing Twig_Extension_GlobalsInterface is deprecated since version 1.23.', $name), E_USER_DEPRECATED);
1466  }
1467  }
1468 
1469  $extGlob = $extension->getGlobals();
1470  if (!is_array($extGlob)) {
1471  throw new UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', get_class($extension)));
1472  }
1473 
1474  $globals[] = $extGlob;
1475  }
1476 
1477  $globals[] = $this->staging->getGlobals();
1478 
1479  return call_user_func_array('array_merge', $globals);
1480  }
Enables usage of the deprecated Twig_Extension::getGlobals() method.
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ initRuntime()

Twig_Environment::initRuntime ( )

Initializes the runtime environment.

Deprecated:
since 1.23 (to be removed in 2.0)

Definition at line 831 of file Environment.php.

References $m, $name, and getExtensions().

Referenced by loadTemplate().

832  {
833  $this->runtimeInitialized = true;
834 
835  foreach ($this->getExtensions() as $name => $extension) {
836  if (!$extension instanceof Twig_Extension_InitRuntimeInterface) {
837  $m = new ReflectionMethod($extension, 'initRuntime');
838 
839  if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) {
840  @trigger_error(sprintf('Defining the initRuntime() method in the "%s" extension is deprecated since version 1.23. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED);
841  }
842  }
843 
844  $extension->initRuntime($this);
845  }
846  }
Enables usage of the deprecated Twig_Extension::initRuntime() method.
if($format !==null) $name
Definition: metadata.php:146
getExtensions()
Returns all registered extensions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAutoReload()

Twig_Environment::isAutoReload ( )

Checks if the auto_reload option is enabled.

Returns
bool true if auto_reload is enabled, false otherwise

Definition at line 220 of file Environment.php.

References $autoReload.

Referenced by loadTemplate().

221  {
222  return $this->autoReload;
223  }
+ Here is the caller graph for this function:

◆ isDebug()

Twig_Environment::isDebug ( )

Checks if debug mode is enabled.

Returns
bool true if debug mode is enabled, false otherwise

Definition at line 194 of file Environment.php.

References $debug.

Referenced by twig_var_dump().

195  {
196  return $this->debug;
197  }
+ Here is the caller graph for this function:

◆ isStrictVariables()

Twig_Environment::isStrictVariables ( )

Checks if the strict_variables option is enabled.

Returns
bool true if strict_variables is enabled, false otherwise

Definition at line 248 of file Environment.php.

References $strictVariables.

Referenced by Twig_NodeVisitor_Optimizer\doEnterNode(), and Twig_NodeVisitor_Optimizer\doLeaveNode().

249  {
250  return $this->strictVariables;
251  }
+ Here is the caller graph for this function:

◆ isTemplateFresh()

Twig_Environment::isTemplateFresh (   $name,
  $time 
)

Returns true if the template is still fresh.

Besides checking the loader for freshness information, this method also checks if the enabled extensions have not changed.

Parameters
string$nameThe template name
int$timeThe last modification time of the cached template
Returns
bool true if the template is fresh, false otherwise

Definition at line 548 of file Environment.php.

References $lastModifiedExtension, $name, $r, $time, and getLoader().

Referenced by loadTemplate().

549  {
550  if (0 === $this->lastModifiedExtension) {
551  foreach ($this->extensions as $extension) {
552  $r = new ReflectionObject($extension);
553  if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModifiedExtension) {
554  $this->lastModifiedExtension = $extensionTime;
555  }
556  }
557  }
558 
559  return $this->lastModifiedExtension <= $time && $this->getLoader()->isFresh($name, $time);
560  }
getLoader()
Gets the Loader instance.
$time
Definition: cron.php:21
if($format !==null) $name
Definition: metadata.php:146
$r
Definition: example_031.php:79
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load()

Twig_Environment::load (   $name)

Loads a template.

Parameters
string | Twig_TemplateWrapper | Twig_Template$nameThe template name
Exceptions
Twig_Error_LoaderWhen the template cannot be found
Twig_Error_RuntimeWhen a previously generated cache is corrupted
Twig_Error_SyntaxWhen an error occurred during compilation
Returns
Twig_TemplateWrapper

Definition at line 392 of file Environment.php.

References $name, and loadTemplate().

393  {
394  if ($name instanceof Twig_TemplateWrapper) {
395  return $name;
396  }
397 
398  if ($name instanceof Twig_Template) {
399  return new Twig_TemplateWrapper($this, $name);
400  }
401 
402  return new Twig_TemplateWrapper($this, $this->loadTemplate($name));
403  }
Exposes a template to userland.
if($format !==null) $name
Definition: metadata.php:146
Default base class for compiled templates.
Definition: Template.php:24
loadTemplate($name, $index=null)
Loads a template internal representation.
+ Here is the call graph for this function:

◆ loadTemplate()

Twig_Environment::loadTemplate (   $name,
  $index = null 
)

Loads a template internal representation.

This method is for internal use only and should never be called directly.

Parameters
string$nameThe template name
int$indexThe index if it is an embedded template
Returns
Twig_TemplateInterface A template instance representing the given template name
Exceptions
Twig_Error_LoaderWhen the template cannot be found
Twig_Error_RuntimeWhen a previously generated cache is corrupted
Twig_Error_SyntaxWhen an error occurred during compilation

Definition at line 422 of file Environment.php.

References $index, $key, $loader, $name, $source, array, compileSource(), getCacheFilename(), getLoader(), getTemplateClass(), initRuntime(), isAutoReload(), isTemplateFresh(), and writeCacheFile().

Referenced by createTemplate(), display(), load(), render(), and resolveTemplate().

423  {
424  $cls = $mainCls = $this->getTemplateClass($name);
425  if (null !== $index) {
426  $cls .= '_'.$index;
427  }
428 
429  if (isset($this->loadedTemplates[$cls])) {
430  return $this->loadedTemplates[$cls];
431  }
432 
433  if (!class_exists($cls, false)) {
434  if ($this->bcGetCacheFilename) {
435  $key = $this->getCacheFilename($name);
436  } else {
437  $key = $this->cache->generateKey($name, $mainCls);
438  }
439 
440  if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
441  $this->cache->load($key);
442  }
443 
444  if (!class_exists($cls, false)) {
445  $loader = $this->getLoader();
446  if (!$loader instanceof Twig_SourceContextLoaderInterface) {
447  $source = new Twig_Source($loader->getSource($name), $name);
448  } else {
449  $source = $loader->getSourceContext($name);
450  }
451 
452  $content = $this->compileSource($source);
453 
454  if ($this->bcWriteCacheFile) {
455  $this->writeCacheFile($key, $content);
456  } else {
457  $this->cache->write($key, $content);
458  $this->cache->load($key);
459  }
460 
461  if (!class_exists($mainCls, false)) {
462  /* Last line of defense if either $this->bcWriteCacheFile was used,
463  * $this->cache is implemented as a no-op or we have a race condition
464  * where the cache was cleared between the above calls to write to and load from
465  * the cache.
466  */
467  eval('?>'.$content);
468  }
469  }
470 
471  if (!class_exists($cls, false)) {
472  throw new Twig_Error_Runtime(sprintf('Failed to load Twig template "%s", index "%s": cache is corrupted.', $name, $index), -1, $source);
473  }
474  }
475 
476  if (!$this->runtimeInitialized) {
477  $this->initRuntime();
478  }
479 
480  if (isset($this->loading[$cls])) {
481  throw new Twig_Error_Runtime(sprintf('Circular reference detected for Twig template "%s", path: %s.', $name, implode(' -> ', array_merge($this->loading, array($name)))));
482  }
483 
484  $this->loading[$cls] = $name;
485 
486  try {
487  $this->loadedTemplates[$cls] = new $cls($this);
488  unset($this->loading[$cls]);
489  } catch (\Exception $e) {
490  unset($this->loading[$cls]);
491 
492  throw $e;
493  }
494 
495  return $this->loadedTemplates[$cls];
496  }
writeCacheFile($file, $content)
getCacheFilename($name)
Gets the cache filename for a given template.
getTemplateClass($name, $index=null)
Gets the template class associated with the given string.
isTemplateFresh($name, $time)
Returns true if the template is still fresh.
Exception thrown when an error occurs at runtime.
Definition: Runtime.php:18
$index
Definition: metadata.php:60
getLoader()
Gets the Loader instance.
initRuntime()
Initializes the runtime environment.
if($format !==null) $name
Definition: metadata.php:146
compileSource($source, $name=null)
Compiles a template source code.
Adds a getSourceContext() method for loaders.
Create styles array
The data for the language used.
isAutoReload()
Checks if the auto_reload option is enabled.
Holds information about a non-compiled Twig template.
Definition: Source.php:19
$source
Definition: linkback.php:22
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mergeGlobals()

Twig_Environment::mergeGlobals ( array  $context)

Merges a context with the defined globals.

Parameters
array$contextAn array representing the context
Returns
array The context merged with the globals

Definition at line 1399 of file Environment.php.

References $key, and getGlobals().

1400  {
1401  // we don't use array_merge as the context being generally
1402  // bigger than globals, this code is faster.
1403  foreach ($this->getGlobals() as $key => $value) {
1404  if (!array_key_exists($key, $context)) {
1405  $context[$key] = $value;
1406  }
1407  }
1408 
1409  return $context;
1410  }
getGlobals()
Gets the registered Globals.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ parse()

Twig_Environment::parse ( Twig_TokenStream  $stream)

Converts a token stream to a node tree.

Returns
Twig_Node_Module
Exceptions
Twig_Error_SyntaxWhen the token stream is syntactically or semantically wrong

Definition at line 710 of file Environment.php.

Referenced by compileSource().

711  {
712  if (null === $this->parser) {
713  $this->parser = new Twig_Parser($this);
714  }
715 
716  return $this->parser->parse($stream);
717  }
Default parser implementation.
Definition: Parser.php:18
+ Here is the caller graph for this function:

◆ registerUndefinedFilterCallback()

Twig_Environment::registerUndefinedFilterCallback (   $callable)

Definition at line 1157 of file Environment.php.

1158  {
1159  $this->filterCallbacks[] = $callable;
1160  }

◆ registerUndefinedFunctionCallback()

Twig_Environment::registerUndefinedFunctionCallback (   $callable)

Definition at line 1316 of file Environment.php.

1317  {
1318  $this->functionCallbacks[] = $callable;
1319  }

◆ removeExtension()

Twig_Environment::removeExtension (   $name)

Removes an extension by name.

This method is deprecated and you should not use it.

Parameters
string$nameThe extension name
Deprecated:
since 1.12 (to be removed in 2.0)

Definition at line 967 of file Environment.php.

References $name, and updateOptionsHash().

968  {
969  @trigger_error(sprintf('The %s method is deprecated since version 1.12 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
970 
971  if ($this->extensionInitialized) {
972  throw new LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name));
973  }
974 
975  $class = ltrim($name, '\\');
976  if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) {
977  // For BC/FC with namespaced aliases
978  $class = new ReflectionClass($class);
979  $class = $class->name;
980  }
981 
982  if (isset($this->extensions[$class])) {
983  if ($class !== get_class($this->extensions[$class])) {
984  @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED);
985  }
986 
987  unset($this->extensions[$class]);
988  }
989 
990  unset($this->extensions[$class]);
991  $this->updateOptionsHash();
992  }
if($format !==null) $name
Definition: metadata.php:146
+ Here is the call graph for this function:

◆ render()

Twig_Environment::render (   $name,
array  $context = array() 
)

Renders a template.

Parameters
string$nameThe template name
array$contextAn array of parameters to pass to the template
Returns
string The rendered template
Exceptions
Twig_Error_LoaderWhen the template cannot be found
Twig_Error_SyntaxWhen an error occurred during compilation
Twig_Error_RuntimeWhen an error occurred during rendering

Definition at line 361 of file Environment.php.

References $name, and loadTemplate().

362  {
363  return $this->loadTemplate($name)->render($context);
364  }
if($format !==null) $name
Definition: metadata.php:146
loadTemplate($name, $index=null)
Loads a template internal representation.
+ Here is the call graph for this function:

◆ resolveTemplate()

Twig_Environment::resolveTemplate (   $names)

Tries to load a template consecutively from an array.

Similar to loadTemplate() but it also accepts instances of Twig_Template and Twig_TemplateWrapper, and an array of templates where each is tried to be loaded.

Parameters
string | Twig_Template | Twig_TemplateWrapper | array$namesA template or an array of templates to try consecutively
Returns
Twig_Template|Twig_TemplateWrapper
Exceptions
Twig_Error_LoaderWhen none of the templates can be found
Twig_Error_SyntaxWhen an error occurred during compilation

Definition at line 575 of file Environment.php.

References $name, $names, array, and loadTemplate().

576  {
577  if (!is_array($names)) {
578  $names = array($names);
579  }
580 
581  foreach ($names as $name) {
582  if ($name instanceof Twig_Template) {
583  return $name;
584  }
585 
586  if ($name instanceof Twig_TemplateWrapper) {
587  return $name;
588  }
589 
590  try {
591  return $this->loadTemplate($name);
592  } catch (Twig_Error_Loader $e) {
593  }
594  }
595 
596  if (1 === count($names)) {
597  throw $e;
598  }
599 
600  throw new Twig_Error_Loader(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names)));
601  }
Exposes a template to userland.
Exception thrown when an error occurs during template loading.
Definition: Loader.php:25
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
Default base class for compiled templates.
Definition: Template.php:24
loadTemplate($name, $index=null)
Loads a template internal representation.
+ Here is the call graph for this function:

◆ setBaseTemplateClass()

Twig_Environment::setBaseTemplateClass (   $class)

Sets the base template class for compiled templates.

Parameters
string$classThe base template class name

Definition at line 165 of file Environment.php.

References updateOptionsHash().

166  {
167  $this->baseTemplateClass = $class;
168  $this->updateOptionsHash();
169  }
+ Here is the call graph for this function:

◆ setCache()

Twig_Environment::setCache (   $cache)

Sets the current cache implementation.

Parameters
Twig_CacheInterface | string | false$cacheA Twig_CacheInterface implementation, an absolute path to the compiled templates, or false to disable cache

Definition at line 274 of file Environment.php.

References $cache.

Referenced by __construct().

275  {
276  if (is_string($cache)) {
277  $this->originalCache = $cache;
278  $this->cache = new Twig_Cache_Filesystem($cache);
279  } elseif (false === $cache) {
280  $this->originalCache = $cache;
281  $this->cache = new Twig_Cache_Null();
282  } elseif (null === $cache) {
283  @trigger_error('Using "null" as the cache strategy is deprecated since version 1.23 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
284  $this->originalCache = false;
285  $this->cache = new Twig_Cache_Null();
286  } elseif ($cache instanceof Twig_CacheInterface) {
287  $this->originalCache = $this->cache = $cache;
288  } else {
289  throw new LogicException(sprintf('Cache can only be a string, false, or a Twig_CacheInterface implementation.'));
290  }
291  }
Implements a cache on the filesystem.
Definition: Filesystem.php:17
Interface implemented by cache classes.
Implements a no-cache strategy.
Definition: Null.php:19
+ Here is the caller graph for this function:

◆ setCharset()

Twig_Environment::setCharset (   $charset)

Sets the default template charset.

Parameters
string$charsetThe default charset

Definition at line 811 of file Environment.php.

References $charset.

812  {
813  $this->charset = strtoupper($charset);
814  }

◆ setCompiler()

Twig_Environment::setCompiler ( Twig_CompilerInterface  $compiler)

Definition at line 737 of file Environment.php.

References $compiler.

738  {
739  $this->compiler = $compiler;
740  }

◆ setExtensions()

Twig_Environment::setExtensions ( array  $extensions)

Registers an array of extensions.

Parameters
array$extensionsAn array of extensions

Definition at line 999 of file Environment.php.

References addExtension().

1000  {
1001  foreach ($extensions as $extension) {
1002  $this->addExtension($extension);
1003  }
1004  }
addExtension(Twig_ExtensionInterface $extension)
+ Here is the call graph for this function:

◆ setLexer()

Twig_Environment::setLexer ( Twig_LexerInterface  $lexer)

Definition at line 651 of file Environment.php.

References $lexer.

652  {
653  $this->lexer = $lexer;
654  }

◆ setLoader()

Twig_Environment::setLoader ( Twig_LoaderInterface  $loader)

Definition at line 783 of file Environment.php.

References $loader.

Referenced by __construct(), and createTemplate().

784  {
785  if (!$loader instanceof Twig_SourceContextLoaderInterface && 0 !== strpos(get_class($loader), 'Mock_')) {
786  @trigger_error(sprintf('Twig loader "%s" should implement Twig_SourceContextLoaderInterface since version 1.27.', get_class($loader)), E_USER_DEPRECATED);
787  }
788 
789  $this->loader = $loader;
790  }
Adds a getSourceContext() method for loaders.
+ Here is the caller graph for this function:

◆ setParser()

Twig_Environment::setParser ( Twig_ParserInterface  $parser)

Definition at line 698 of file Environment.php.

References $parser.

699  {
700  $this->parser = $parser;
701  }

◆ tokenize()

Twig_Environment::tokenize (   $source,
  $name = null 
)

Tokenizes a source code.

Parameters
string | Twig_Source$sourceThe template source code
string$nameThe template name (deprecated)
Returns
Twig_TokenStream
Exceptions
Twig_Error_SyntaxWhen the code is syntactically wrong

Definition at line 666 of file Environment.php.

References $name, and $source.

Referenced by compileSource().

667  {
668  if (!$source instanceof Twig_Source) {
669  @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
670  $source = new Twig_Source($source, $name);
671  }
672 
673  if (null === $this->lexer) {
674  $this->lexer = new Twig_Lexer($this);
675  }
676 
677  return $this->lexer->tokenize($source);
678  }
if($format !==null) $name
Definition: metadata.php:146
Holds information about a non-compiled Twig template.
Definition: Source.php:19
$source
Definition: linkback.php:22
Lexes a template string.
Definition: Lexer.php:18
+ Here is the caller graph for this function:

◆ updateOptionsHash()

Twig_Environment::updateOptionsHash ( )
private

Definition at line 1586 of file Environment.php.

References array.

Referenced by addExtension(), disableDebug(), disableStrictVariables(), enableDebug(), enableStrictVariables(), removeExtension(), and setBaseTemplateClass().

1587  {
1588  $hashParts = array_merge(
1589  array_keys($this->extensions),
1590  array(
1591  (int) function_exists('twig_template_get_attributes'),
1592  PHP_MAJOR_VERSION,
1593  PHP_MINOR_VERSION,
1594  self::VERSION,
1595  (int) $this->debug,
1596  $this->baseTemplateClass,
1597  (int) $this->strictVariables,
1598  )
1599  );
1600  $this->optionsHash = implode(':', $hashParts);
1601  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ writeCacheFile()

Twig_Environment::writeCacheFile (   $file,
  $content 
)
protected
Deprecated:
since 1.22 (to be removed in 2.0)

Definition at line 1581 of file Environment.php.

References $file.

Referenced by loadTemplate().

1582  {
1583  $this->cache->write($file, $content);
1584  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the caller graph for this function:

Field Documentation

◆ $autoReload

Twig_Environment::$autoReload
protected

Definition at line 29 of file Environment.php.

Referenced by isAutoReload().

◆ $baseTemplateClass

Twig_Environment::$baseTemplateClass
protected

Definition at line 34 of file Environment.php.

Referenced by getBaseTemplateClass().

◆ $bcGetCacheFilename

Twig_Environment::$bcGetCacheFilename = false
private

Definition at line 55 of file Environment.php.

◆ $bcWriteCacheFile

Twig_Environment::$bcWriteCacheFile = false
private

Definition at line 54 of file Environment.php.

◆ $binaryOperators

Twig_Environment::$binaryOperators
protected

Definition at line 47 of file Environment.php.

Referenced by getBinaryOperators().

◆ $cache

Twig_Environment::$cache
protected

Definition at line 30 of file Environment.php.

Referenced by getCache(), and setCache().

◆ $charset

Twig_Environment::$charset
protected

Definition at line 26 of file Environment.php.

Referenced by getCharset(), and setCharset().

◆ $compiler

Twig_Environment::$compiler
protected

Definition at line 33 of file Environment.php.

Referenced by getCompiler(), and setCompiler().

◆ $debug

Twig_Environment::$debug
protected

Definition at line 28 of file Environment.php.

Referenced by isDebug().

◆ $extensionInitialized

Twig_Environment::$extensionInitialized = false
protected

Definition at line 43 of file Environment.php.

◆ $extensions

Twig_Environment::$extensions
protected

Definition at line 35 of file Environment.php.

Referenced by getExtensions().

◆ $extensionsByClass

Twig_Environment::$extensionsByClass = array()
private

Definition at line 57 of file Environment.php.

◆ $filterCallbacks

Twig_Environment::$filterCallbacks = array()
protected

Definition at line 50 of file Environment.php.

◆ $filters

Twig_Environment::$filters
protected

Definition at line 38 of file Environment.php.

Referenced by getFilters().

◆ $functionCallbacks

Twig_Environment::$functionCallbacks = array()
protected

Definition at line 49 of file Environment.php.

◆ $functions

Twig_Environment::$functions
protected

Definition at line 40 of file Environment.php.

Referenced by getFunctions().

◆ $globals

Twig_Environment::$globals
protected

Definition at line 41 of file Environment.php.

Referenced by getGlobals(), and initGlobals().

◆ $lastModifiedExtension

Twig_Environment::$lastModifiedExtension = 0
private

Definition at line 56 of file Environment.php.

Referenced by isTemplateFresh().

◆ $lexer

Twig_Environment::$lexer
protected

Definition at line 31 of file Environment.php.

Referenced by getLexer(), and setLexer().

◆ $loadedTemplates

Twig_Environment::$loadedTemplates
protected

Definition at line 44 of file Environment.php.

◆ $loader

◆ $loading

Twig_Environment::$loading = array()
private

Definition at line 61 of file Environment.php.

◆ $optionsHash

Twig_Environment::$optionsHash
private

Definition at line 60 of file Environment.php.

◆ $originalCache

Twig_Environment::$originalCache
private

Definition at line 53 of file Environment.php.

◆ $parser

Twig_Environment::$parser
protected

Definition at line 32 of file Environment.php.

Referenced by getParser(), getTags(), initExtension(), and setParser().

◆ $parsers

Twig_Environment::$parsers
protected

Definition at line 36 of file Environment.php.

Referenced by getTokenParsers().

◆ $runtimeInitialized

Twig_Environment::$runtimeInitialized = false
protected

Definition at line 42 of file Environment.php.

◆ $runtimeLoaders

Twig_Environment::$runtimeLoaders = array()
private

Definition at line 58 of file Environment.php.

◆ $runtimes

Twig_Environment::$runtimes = array()
private

Definition at line 59 of file Environment.php.

◆ $staging

Twig_Environment::$staging
protected

Definition at line 51 of file Environment.php.

◆ $strictVariables

Twig_Environment::$strictVariables
protected

Definition at line 45 of file Environment.php.

Referenced by isStrictVariables().

◆ $templateClassPrefix

Twig_Environment::$templateClassPrefix = '__TwigTemplate_'
protected

Definition at line 48 of file Environment.php.

Referenced by getTemplateClassPrefix().

◆ $tests

Twig_Environment::$tests
protected

Definition at line 39 of file Environment.php.

Referenced by getTests().

◆ $unaryOperators

Twig_Environment::$unaryOperators
protected

Definition at line 46 of file Environment.php.

Referenced by getUnaryOperators().

◆ $visitors

Twig_Environment::$visitors
protected

Definition at line 37 of file Environment.php.

Referenced by getNodeVisitors().

◆ EXTRA_VERSION

const Twig_Environment::EXTRA_VERSION = ''

Definition at line 24 of file Environment.php.

◆ MAJOR_VERSION

const Twig_Environment::MAJOR_VERSION = 1

Definition at line 21 of file Environment.php.

◆ MINOR_VERSION

const Twig_Environment::MINOR_VERSION = 35

Definition at line 22 of file Environment.php.

◆ RELEASE_VERSION

const Twig_Environment::RELEASE_VERSION = 3

Definition at line 23 of file Environment.php.

◆ VERSION

const Twig_Environment::VERSION = '1.35.3'

Definition at line 19 of file Environment.php.

◆ VERSION_ID

const Twig_Environment::VERSION_ID = 13503

Definition at line 20 of file Environment.php.


The documentation for this class was generated from the following file: