Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

Expression.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 2.67 KiB


001  <?php
002   
003  /*
004   * This file is part of the Symfony package.
005   *
006   * (c) Fabien Potencier <fabien@symfony.com>
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 Symfony\Component\Finder\Expression;
013   
014  @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
015   
016  /**
017   * @author Jean-François Simon <contact@jfsimon.fr>
018   */
019  class Expression implements ValueInterface
020  {
021      const TYPE_REGEX = 1;
022      const TYPE_GLOB = 2;
023   
024      /**
025       * @var ValueInterface
026       */
027      private $value;
028   
029      /**
030       * @param string $expr
031       *
032       * @return Expression
033       */
034      public static function create($expr)
035      {
036          return new self($expr);
037      }
038   
039      /**
040       * @param string $expr
041       */
042      public function __construct($expr)
043      {
044          try {
045              $this->value = Regex::create($expr);
046          } catch (\InvalidArgumentException $e) {
047              $this->value = new Glob($expr);
048          }
049      }
050   
051      /**
052       * @return string
053       */
054      public function __toString()
055      {
056          return $this->render();
057      }
058   
059      /**
060       * {@inheritdoc}
061       */
062      public function render()
063      {
064          return $this->value->render();
065      }
066   
067      /**
068       * {@inheritdoc}
069       */
070      public function renderPattern()
071      {
072          return $this->value->renderPattern();
073      }
074   
075      /**
076       * @return bool
077       */
078      public function isCaseSensitive()
079      {
080          return $this->value->isCaseSensitive();
081      }
082   
083      /**
084       * @return int
085       */
086      public function getType()
087      {
088          return $this->value->getType();
089      }
090   
091      /**
092       * {@inheritdoc}
093       */
094      public function prepend($expr)
095      {
096          $this->value->prepend($expr);
097   
098          return $this;
099      }
100   
101      /**
102       * {@inheritdoc}
103       */
104      public function append($expr)
105      {
106          $this->value->append($expr);
107   
108          return $this;
109      }
110   
111      /**
112       * @return bool
113       */
114      public function isRegex()
115      {
116          return self::TYPE_REGEX === $this->value->getType();
117      }
118   
119      /**
120       * @return bool
121       */
122      public function isGlob()
123      {
124          return self::TYPE_GLOB === $this->value->getType();
125      }
126   
127      /**
128       * @return Glob
129       *
130       * @throws \LogicException
131       */
132      public function getGlob()
133      {
134          if (self::TYPE_GLOB !== $this->value->getType()) {
135              throw new \LogicException('Regex can\'t be transformed to glob.');
136          }
137   
138          return $this->value;
139      }
140   
141      /**
142       * @return Regex
143       */
144      public function getRegex()
145      {
146          return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
147      }
148  }
149