You are here

public function MatchableRegex::match in AmazonS3 7.2

File

src/Matchable/MatchableRegex.php, line 18

Class

MatchableRegex
Base class for objects that can be matched against a regular expression.

Namespace

Drupal\amazons3\Matchable

Code

public function match($subject) {
  $pattern = $this
    ->__toString();
  if ($pattern === '*' || preg_match('#' . strtr($pattern, '#', '\\#') . '#', $subject)) {
    return $this;
  }
  return FALSE;
}