/** * @param array $path * @return Source|null */ public function sourceForPath(array $path) { foreach ($this->sources as $source) { if (RouteMatcher::matches($source, $path)) { return $source; } } return null; }
public function testRegexNotValid() { /* Given */ $source = Source::build(['tracks', '/[0-9]+/'], function () { }); /* When */ $result = RouteMatcher::matches($source, ['tracks', 'length']); /* Then */ assertThat($result, is(false)); }