TYPO3  7.6
Expression/Glob.php
Go to the documentation of this file.
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 use Symfony\Component\Finder\Glob as FinderGlob;
15 
19 class Glob implements ValueInterface
20 {
24  private $pattern;
25 
29  public function __construct($pattern)
30  {
31  $this->pattern = $pattern;
32  }
33 
37  public function render()
38  {
39  return $this->pattern;
40  }
41 
45  public function renderPattern()
46  {
47  return $this->pattern;
48  }
49 
53  public function getType()
54  {
55  return Expression::TYPE_GLOB;
56  }
57 
61  public function isCaseSensitive()
62  {
63  return true;
64  }
65 
69  public function prepend($expr)
70  {
71  $this->pattern = $expr.$this->pattern;
72 
73  return $this;
74  }
75 
79  public function append($expr)
80  {
81  $this->pattern .= $expr;
82 
83  return $this;
84  }
85 
91  public function isExpandable()
92  {
93  return false !== strpos($this->pattern, '{')
94  && false !== strpos($this->pattern, '}');
95  }
96 
103  public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
104  {
105  $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
106 
107  return new Regex($regex);
108  }
109 }