You are here

public function BasicPath::__construct in AmazonS3 7.2

Construct a new BasicPath.

Parameters

$pattern: An regular expression pattern, without start and end markers.

1 method overrides BasicPath::__construct()
PresignedPath::__construct in src/Matchable/PresignedPath.php

File

src/Matchable/BasicPath.php, line 46

Class

BasicPath
A path pattern to use when testing URL paths.

Namespace

Drupal\amazons3\Matchable

Code

public function __construct($pattern) {
  $result = @preg_match('#' . strtr($pattern, '#', '\\#') . '#', 'foo');
  if ($pattern != '*' && ($result === FALSE || preg_last_error() != PREG_NO_ERROR)) {
    throw new \InvalidArgumentException('BasicPath pattern is not a valid regular expression.');
  }
  $this->pattern = $pattern;
}