public function parse($request)
{
if (!preg_match('#' . self::PATTERN . '#', $request, $matches)) {
return false;
}
return [$this->relativePath($matches[1] . '.' . $matches[5]), $matches[2] == '_' ? null : (int) $matches[2], $matches[3] == '_' ? null : (int) $matches[3], $this->options($matches[4])];
}
public function testCropsInSubDirectory() { $url = new URL(['path' => 'images/(?:crops/)?(.*)$']); $this->assertEquals(['file.jpg', 200, 100, []], $url->parse('images/crops/file-200x100.jpg')); }