Sulu\Bundle\MediaBundle\Media\FormatCache\LocalFormatCache::getFormatFromUrl PHP Method

getFormatFromUrl() protected method

return the format by a given url.
protected getFormatFromUrl ( string $url ) : string
$url string
return string
    protected function getFormatFromUrl($url)
    {
        $path = dirname($url);
        $formatParts = array_reverse(explode('/', $path));
        if (count($formatParts) < 2) {
            throw new ImageProxyInvalidUrl('No `format` was found in the url');
        }
        $format = $formatParts[1];
        return $format;
    }