trait MatchableRegex in AmazonS3 7.2
Base class for objects that can be matched against a regular expression.
This class also handles '*' to mean 'any string'.
@class MatchableRegex @package Drupal\amazons3\Matchable
Hierarchy
- trait \Drupal\amazons3\Matchable\MatchableRegex
File
- src/
Matchable/ MatchableRegex.php, line 13
Namespace
Drupal\amazons3\MatchableView source
trait MatchableRegex {
/**
* {@inheritdoc}
*/
public function match($subject) {
$pattern = $this
->__toString();
if ($pattern === '*' || preg_match('#' . strtr($pattern, '#', '\\#') . '#', $subject)) {
return $this;
}
return FALSE;
}
/**
* Return the pattern this object matches against.
*
* @return string
*/
public abstract function __toString();
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MatchableRegex:: |
public | function | ||
MatchableRegex:: |
abstract public | function | Return the pattern this object matches against. | 1 |