Bkwld\Croppa\URL::parse PHP 메소드

parse() 공개 메소드

Parse a request path into Croppa instructions
public parse ( string $request ) : array | boolean
$request string
리턴 array | boolean | boolean
    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])];
    }

Usage Example

예제 #1
0
 public function testCropsInSubDirectory()
 {
     $url = new URL(['path' => 'images/(?:crops/)?(.*)$']);
     $this->assertEquals(['file.jpg', 200, 100, []], $url->parse('images/crops/file-200x100.jpg'));
 }