/** * @param string $string * @return bool */ public function allows($string) { Assertion::string($string, 'Scope to check should be a string, "%s" given'); if (!$this->isRegexp) { return $this->scope === $string; } $regexp = new RegularExpression($this->scope); return $regexp->matches($string); }
/** * @test * @group metadata * @group contactperson * * @dataProvider \OpenConext\Value\TestDataProvider::invalidRegularExpressionProvider * @expectedException InvalidArgumentException * * @param string $invalidPattern */ public function deserialization_requires_valid_data($invalidPattern) { RegularExpression::deserialize($invalidPattern); }