[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/finder/Expression/ -> Glob.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\Finder\Expression;
  13  
  14  @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  15  
  16  use Symfony\Component\Finder\Glob as FinderGlob;
  17  
  18  /**
  19   * @author Jean-François Simon <contact@jfsimon.fr>
  20   */
  21  class Glob implements ValueInterface
  22  {
  23      private $pattern;
  24  
  25      /**
  26       * @param string $pattern
  27       */
  28      public function __construct($pattern)
  29      {
  30          $this->pattern = $pattern;
  31      }
  32  
  33      /**
  34       * {@inheritdoc}
  35       */
  36      public function render()
  37      {
  38          return $this->pattern;
  39      }
  40  
  41      /**
  42       * {@inheritdoc}
  43       */
  44      public function renderPattern()
  45      {
  46          return $this->pattern;
  47      }
  48  
  49      /**
  50       * {@inheritdoc}
  51       */
  52      public function getType()
  53      {
  54          return Expression::TYPE_GLOB;
  55      }
  56  
  57      /**
  58       * {@inheritdoc}
  59       */
  60      public function isCaseSensitive()
  61      {
  62          return true;
  63      }
  64  
  65      /**
  66       * {@inheritdoc}
  67       */
  68      public function prepend($expr)
  69      {
  70          $this->pattern = $expr.$this->pattern;
  71  
  72          return $this;
  73      }
  74  
  75      /**
  76       * {@inheritdoc}
  77       */
  78      public function append($expr)
  79      {
  80          $this->pattern .= $expr;
  81  
  82          return $this;
  83      }
  84  
  85      /**
  86       * Tests if glob is expandable ("*.{a,b}" syntax).
  87       *
  88       * @return bool
  89       */
  90      public function isExpandable()
  91      {
  92          return false !== strpos($this->pattern, '{')
  93              && false !== strpos($this->pattern, '}');
  94      }
  95  
  96      /**
  97       * @param bool $strictLeadingDot
  98       * @param bool $strictWildcardSlash
  99       *
 100       * @return Regex
 101       */
 102      public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
 103      {
 104          $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
 105  
 106          return new Regex($regex);
 107      }
 108  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1