Final Class Yiisoft\Files\PathMatcher\CompositeMatcher
| Inheritance | Yiisoft\Files\PathMatcher\CompositeMatcher |
|---|---|
| Implements | Yiisoft\Files\PathMatcher\PathMatcherInterface |
Composite matcher allows combining several matchers.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| all() | Get an instance of composite matcher that gives a match only if all of sub-matchers match. | Yiisoft\Files\PathMatcher\CompositeMatcher |
| any() | Get an instance of composite matcher that gives a match if any of sub-matchers match. | Yiisoft\Files\PathMatcher\CompositeMatcher |
| match() | Yiisoft\Files\PathMatcher\CompositeMatcher |
Method Details
Get an instance of composite matcher that gives a match only if all of sub-matchers match.
| public static self all ( Yiisoft\Files\PathMatcher\PathMatcherInterface $matchers ) | ||
| $matchers | Yiisoft\Files\PathMatcher\PathMatcherInterface |
Matchers to check. |
public static function all(PathMatcherInterface ...$matchers): self
{
return new self(false, ...$matchers);
}
Get an instance of composite matcher that gives a match if any of sub-matchers match.
| public static self any ( Yiisoft\Files\PathMatcher\PathMatcherInterface $matchers ) | ||
| $matchers | Yiisoft\Files\PathMatcher\PathMatcherInterface |
Matchers to check. |
public static function any(PathMatcherInterface ...$matchers): self
{
return new self(true, ...$matchers);
}
| public boolean|null match ( string $path ) | ||
| $path | string | |
public function match(string $path): ?bool
{
$allNulls = true;
foreach ($this->matchers as $matcher) {
$match = $matcher->match($path);
if ($match === null) {
continue;
}
$allNulls = false;
if ($this->matchAny && $match) {
return true;
}
if (!$this->matchAny && !$match) {
return false;
}
}
return $allNulls ? null : !$this->matchAny;
}
Signup or Login in order to comment.