/** * @param string $url * @param string $urlPrefix * @param flavorAsset|flavorParams $flavor * @return array */ protected function getFlavorAssetInfo($url, $urlPrefix = '', $flavor = null) { $ext = null; if ($flavor && is_callable(array($flavor, 'getFileExt'))) { $ext = $flavor->getFileExt(); } if (!$ext) { if ($urlPrefix && $url) { $urlPrefix = $urlPrefix . "/"; } $urlPath = parse_url($urlPrefix . $url, PHP_URL_PATH); $ext = pathinfo($urlPath, PATHINFO_EXTENSION); } $bitrate = $flavor ? $flavor->getVideoBitrate() : 0; $width = $flavor ? $flavor->getWidth() : 0; $height = $flavor ? $flavor->getHeight() : 0; return array('url' => $url, 'urlPrefix' => $urlPrefix, 'ext' => $ext, 'bitrate' => $bitrate, 'width' => $width, 'height' => $height); }
/** * @param string $url * @param string $urlPrefix * @param flavorAsset $flavorAsset * @return array */ private function getFlavorAssetInfo($url, $urlPrefix = '', flavorAsset $flavorAsset = null) { $ext = null; if ($flavorAsset) { $ext = $flavorAsset->getFileExt(); } if (!$ext) { $parsedUrl = parse_url($urlPrefix . $url); $ext = pathinfo($parsedUrl['path'], PATHINFO_EXTENSION); } $bitrate = $flavorAsset ? $flavorAsset->getBitrate() : 0; $width = $flavorAsset ? $flavorAsset->getWidth() : 0; $height = $flavorAsset ? $flavorAsset->getHeight() : 0; return array('url' => $url, 'urlPrefix' => $urlPrefix, 'ext' => $ext, 'bitrate' => $bitrate, 'width' => $width, 'height' => $height); }