/** * @param string $scope the scope as defined * @param bool $isRegexp whether or not the scope is a regular expression as identified by the regexp attribute */ public function __construct($scope, $isRegexp = false) { Assertion::nonEmptyString($scope, 'scope'); Assertion::boolean($isRegexp); if ($isRegexp) { Assertion::validRegularExpression($scope, 'scope'); } $this->scope = $scope; $this->isRegexp = $isRegexp; }
/** * @test * * @dataProvider \OpenConext\Value\TestDataProvider::invalidRegularExpressionProvider * @expectedException InvalidArgumentException * * @param string $invalidPattern */ public function an_invalid_regular_expression_does_not_pass_the_assertion($invalidPattern) { Assertion::validRegularExpression($invalidPattern, 'invalidPattern'); }
/** * @param string $pattern */ public function __construct($pattern) { Assertion::nonEmptyString($pattern, 'pattern'); Assertion::validRegularExpression($pattern, 'pattern'); $this->pattern = $pattern; }