protected function toRegex($str) { if (preg_match('/^([^a-zA-Z0-9\\\\]).+?\\1[ims]?$/', $str)) { return $str; } return Glob::toRegex($str); }
/** * @dataProvider getToRegexData */ public function testToRegex($glob, $match, $noMatch) { foreach ($match as $m) { $this->assertRegExp(Glob::toRegex($glob), $m, '::toRegex() converts a glob to a regexp'); } foreach ($noMatch as $m) { $this->assertNotRegExp(Glob::toRegex($glob), $m, '::toRegex() converts a glob to a regexp'); } }