BasicPath.php in AmazonS3 7.2
File
src/Matchable/BasicPath.php
View source
<?php
namespace Drupal\amazons3\Matchable;
class BasicPath implements Matchable {
use MatchableRegex;
protected $pattern;
public static function factory(array $patterns) {
$basicPaths = array();
foreach ($patterns as $pattern) {
$basicPaths[] = new static($pattern);
}
return $basicPaths;
}
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;
}
public function getPath() {
return $this->pattern;
}
function __toString() {
return $this->pattern;
}
}
Classes
Name |
Description |
BasicPath |
A path pattern to use when testing URL paths. |