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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

TwigTest.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 2.62 KiB


001  <?php
002   
003  /*
004   * This file is part of Twig.
005   *
006   * (c) Fabien Potencier
007   *
008   * For the full copyright and license information, please view the LICENSE
009   * file that was distributed with this source code.
010   */
011   
012  namespace Twig;
013   
014  use Twig\Node\Expression\TestExpression;
015   
016  /**
017   * Represents a template test.
018   *
019   * @final since Twig 2.4.0
020   *
021   * @author Fabien Potencier <fabien@symfony.com>
022   *
023   * @see https://twig.symfony.com/doc/templates.html#test-operator
024   */
025  class TwigTest
026  {
027      private $name;
028      private $callable;
029      private $options;
030      private $arguments = [];
031   
032      /**
033       * Creates a template test.
034       *
035       * @param string        $name     Name of this test
036       * @param callable|null $callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation.
037       * @param array         $options  Options array
038       */
039      public function __construct(string $name, $callable = null, array $options = [])
040      {
041          if (__CLASS__ !== static::class) {
042              @trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', \E_USER_DEPRECATED);
043          }
044   
045          $this->name = $name;
046          $this->callable = $callable;
047          $this->options = array_merge([
048              'is_variadic' => false,
049              'node_class' => TestExpression::class,
050              'deprecated' => false,
051              'alternative' => null,
052              'one_mandatory_argument' => false,
053          ], $options);
054      }
055   
056      public function getName()
057      {
058          return $this->name;
059      }
060   
061      /**
062       * Returns the callable to execute for this test.
063       *
064       * @return callable|null
065       */
066      public function getCallable()
067      {
068          return $this->callable;
069      }
070   
071      public function getNodeClass()
072      {
073          return $this->options['node_class'];
074      }
075   
076      public function setArguments($arguments)
077      {
078          $this->arguments = $arguments;
079      }
080   
081      public function getArguments()
082      {
083          return $this->arguments;
084      }
085   
086      public function isVariadic()
087      {
088          return $this->options['is_variadic'];
089      }
090   
091      public function isDeprecated()
092      {
093          return (bool) $this->options['deprecated'];
094      }
095   
096      public function getDeprecatedVersion()
097      {
098          return $this->options['deprecated'];
099      }
100   
101      public function getAlternative()
102      {
103          return $this->options['alternative'];
104      }
105   
106      public function hasOneMandatoryArgument(): bool
107      {
108          return (bool) $this->options['one_mandatory_argument'];
109      }
110  }
111   
112  // For Twig 1.x compatibility
113  class_alias('Twig\TwigTest', 'Twig_SimpleTest', false);
114   
115  class_alias('Twig\TwigTest', 'Twig_Test');
116