Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
NameExpression.php
001 <?php
002
003 /*
004 * This file is part of Twig.
005 *
006 * (c) Fabien Potencier
007 * (c) Armin Ronacher
008 *
009 * For the full copyright and license information, please view the LICENSE
010 * file that was distributed with this source code.
011 */
012
013 namespace Twig\Node\Expression;
014
015 use Twig\Compiler;
016
017 class NameExpression extends AbstractExpression
018 {
019 private $specialVars = [
020 '_self' => '$this->getTemplateName()',
021 '_context' => '$context',
022 '_charset' => '$this->env->getCharset()',
023 ];
024
025 public function __construct(string $name, int $lineno)
026 {
027 parent::__construct([], ['name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false], $lineno);
028 }
029
030 public function compile(Compiler $compiler)
031 {
032 $name = $this->getAttribute('name');
033
034 $compiler->addDebugInfo($this);
035
036 if ($this->getAttribute('is_defined_test')) {
037 if ($this->isSpecial()) {
038 $compiler->repr(true);
039 } elseif (\PHP_VERSION_ID >= 70400) {
040 $compiler
041 ->raw('array_key_exists(')
042 ->string($name)
043 ->raw(', $context)')
044 ;
045 } else {
046 $compiler
047 ->raw('(isset($context[')
048 ->string($name)
049 ->raw(']) || array_key_exists(')
050 ->string($name)
051 ->raw(', $context))')
052 ;
053 }
054 } elseif ($this->isSpecial()) {
055 $compiler->raw($this->specialVars[$name]);
056 } elseif ($this->getAttribute('always_defined')) {
057 $compiler
058 ->raw('$context[')
059 ->string($name)
060 ->raw(']')
061 ;
062 } else {
063 if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) {
064 $compiler
065 ->raw('($context[')
066 ->string($name)
067 ->raw('] ?? null)')
068 ;
069 } else {
070 $compiler
071 ->raw('(isset($context[')
072 ->string($name)
073 ->raw(']) || array_key_exists(')
074 ->string($name)
075 ->raw(', $context) ? $context[')
076 ->string($name)
077 ->raw('] : (function () { throw new RuntimeError(\'Variable ')
078 ->string($name)
079 ->raw(' does not exist.\', ')
080 ->repr($this->lineno)
081 ->raw(', $this->source); })()')
082 ->raw(')')
083 ;
084 }
085 }
086 }
087
088 public function isSpecial()
089 {
090 return isset($this->specialVars[$this->getAttribute('name')]);
091 }
092
093 public function isSimple()
094 {
095 return !$this->isSpecial() && !$this->getAttribute('is_defined_test');
096 }
097 }
098
099 class_alias('Twig\Node\Expression\NameExpression', 'Twig_Node_Expression_Name');
100