4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Finder\Expression;
14 @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
16 use Symfony\Component\Finder\Glob as FinderGlob;
19 * @author Jean-François Simon <contact@jfsimon.fr>
21 class Glob implements ValueInterface
26 * @param string $pattern
28 public function __construct($pattern)
30 $this->pattern = $pattern;
36 public function render()
38 return $this->pattern;
44 public function renderPattern()
46 return $this->pattern;
52 public function getType()
54 return Expression::TYPE_GLOB;
60 public function isCaseSensitive()
68 public function prepend($expr)
70 $this->pattern = $expr.$this->pattern;
78 public function append($expr)
80 $this->pattern .= $expr;
86 * Tests if glob is expandable ("*.{a,b}" syntax).
90 public function isExpandable()
92 return false !== strpos($this->pattern, '{')
93 && false !== strpos($this->pattern, '}');
97 * @param bool $strictLeadingDot
98 * @param bool $strictWildcardSlash
102 public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
104 $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
106 return new Regex($regex);