[Finder] Fixed expression classes.
This commit is contained in:
parent
5c6dbebf04
commit
6258d1203b
@ -86,6 +86,26 @@ class Expression implements ValueInterface
|
||||
return $this->value->getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepend($expr)
|
||||
{
|
||||
$this->value->prepend($expr);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function append($expr)
|
||||
{
|
||||
$this->value->append($expr);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -61,6 +61,26 @@ class Glob implements ValueInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepend($expr)
|
||||
{
|
||||
$this->pattern = $expr.$this->pattern;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function append($expr)
|
||||
{
|
||||
$this->pattern .= $expr;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $strictLeadingDot
|
||||
* @param bool $strictWildcardSlash
|
||||
|
@ -66,7 +66,7 @@ class Regex implements ValueInterface
|
||||
$end = substr($m[1], -1);
|
||||
|
||||
if (($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start)) || ($start === '{' && $end === '}')) {
|
||||
return new self(substr($m[1], 1, -1), $m[2]);
|
||||
return new self(substr($m[1], 1, -1), $m[2], $end);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,9 +76,15 @@ class Regex implements ValueInterface
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param string $options
|
||||
* @param string $delimiter
|
||||
*/
|
||||
public function __construct($pattern, $options = '')
|
||||
public function __construct($pattern, $options = '', $delimiter = null)
|
||||
{
|
||||
if (null !== $delimiter) {
|
||||
// removes delimiter escaping
|
||||
$pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
|
||||
}
|
||||
|
||||
$this->parsePattern($pattern);
|
||||
$this->options = $options;
|
||||
}
|
||||
@ -109,7 +115,7 @@ class Regex implements ValueInterface
|
||||
{
|
||||
return ($this->startFlag ? self::START_FLAG : '')
|
||||
.($this->startJoker ? self::JOKER : '')
|
||||
.$this->pattern
|
||||
.str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
|
||||
.($this->endJoker ? self::JOKER : '')
|
||||
.($this->endFlag ? self::END_FLAG : '');
|
||||
}
|
||||
@ -130,6 +136,26 @@ class Regex implements ValueInterface
|
||||
return Expression::TYPE_REGEX;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepend($expr)
|
||||
{
|
||||
$this->pattern = $expr.$this->pattern;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function append($expr)
|
||||
{
|
||||
$this->pattern .= $expr;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $option
|
||||
*
|
||||
@ -246,30 +272,6 @@ class Regex implements ValueInterface
|
||||
return $this->endJoker;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $expr
|
||||
*
|
||||
* @return Regex
|
||||
*/
|
||||
public function prepend($expr)
|
||||
{
|
||||
$this->pattern = $expr.$this->pattern;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $expr
|
||||
*
|
||||
* @return Regex
|
||||
*/
|
||||
public function append($expr)
|
||||
{
|
||||
$this->pattern .= $expr;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $replacements
|
||||
*
|
||||
|
@ -43,4 +43,18 @@ interface ValueInterface
|
||||
* @return int
|
||||
*/
|
||||
function getType();
|
||||
|
||||
/**
|
||||
* @param string $expr
|
||||
*
|
||||
* @return ValueInterface
|
||||
*/
|
||||
public function prepend($expr);
|
||||
|
||||
/**
|
||||
* @param string $expr
|
||||
*
|
||||
* @return ValueInterface
|
||||
*/
|
||||
public function append($expr);
|
||||
}
|
||||
|
Reference in New Issue
Block a user