Abstract Class Yiisoft\Strings\AbstractCombinedRegexp
| Inheritance | Yiisoft\Strings\AbstractCombinedRegexp |
|---|---|
| Subclasses | Yiisoft\Strings\CombinedRegexp, Yiisoft\Strings\MemoizedCombinedRegexp |
CombinedRegexp optimizes matching of multiple regular expressions.
Read more about the concept in {@see https://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html}.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| getCompiledPattern() | Yiisoft\Strings\AbstractCombinedRegexp | |
| getFlags() | Yiisoft\Strings\AbstractCombinedRegexp | |
| getMatchingPattern() | Returns pattern that matches the given string. | Yiisoft\Strings\AbstractCombinedRegexp |
| getMatchingPatternPosition() | Returns position of the pattern that matches the given string. | Yiisoft\Strings\AbstractCombinedRegexp |
| getPatterns() | Yiisoft\Strings\AbstractCombinedRegexp | |
| matches() | Returns true whether the given string matches any of the patterns, false - otherwise. |
Yiisoft\Strings\AbstractCombinedRegexp |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| throwFailedMatchException() | Yiisoft\Strings\AbstractCombinedRegexp |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| QUOTE_REPLACER | '\/' | Yiisoft\Strings\AbstractCombinedRegexp | |
| REGEXP_DELIMITER | '/' | Yiisoft\Strings\AbstractCombinedRegexp |
Method Details
| public abstract string getCompiledPattern ( ) | ||
| return | string |
The compiled pattern. |
|---|---|---|
abstract public function getCompiledPattern(): string;
| public abstract string getFlags ( ) | ||
| return | string |
Flags to apply to all regular expressions. |
|---|---|---|
abstract public function getFlags(): string;
Returns pattern that matches the given string.
| public abstract string getMatchingPattern ( string $string ) | ||
| $string | string | |
| throws | Exception |
if the string does not match any of the patterns. |
|---|---|---|
abstract public function getMatchingPattern(string $string): string;
Returns position of the pattern that matches the given string.
| public abstract integer getMatchingPatternPosition ( string $string ) | ||
| $string | string | |
| throws | Exception |
if the string does not match any of the patterns. |
|---|---|---|
abstract public function getMatchingPatternPosition(string $string): int;
| public abstract string[] getPatterns ( ) | ||
| return | string[] |
Regular expressions to combine. |
|---|---|---|
abstract public function getPatterns(): array;
Returns true whether the given string matches any of the patterns, false - otherwise.
| public abstract boolean matches ( string $string ) | ||
| $string | string | |
abstract public function matches(string $string): bool;
| protected void throwFailedMatchException ( string $string ) | ||
| $string | string | |
| throws | Exception | |
|---|---|---|
protected function throwFailedMatchException(string $string): void
{
throw new Exception(
sprintf(
'Failed to match pattern "%s" with string "%s".',
$this->getCompiledPattern(),
$string,
)
);
}
Signup or Login in order to comment.