Do not calculate $isWrapped if not needed.

This commit is contained in:
Andreas Fischer 2013-10-29 12:54:30 +01:00
parent b0b76fe064
commit a04a01d51f
1 changed files with 1 additions and 2 deletions

View File

@ -61,8 +61,6 @@ class Detection {
* @return string * @return string
*/ */
public function detect($path) { public function detect($path) {
$isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://');
if (@is_dir($path)) { if (@is_dir($path)) {
// directories are easy // directories are easy
return "httpd/unix-directory"; return "httpd/unix-directory";
@ -79,6 +77,7 @@ class Detection {
} }
finfo_close($finfo); finfo_close($finfo);
} }
$isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://');
if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) { if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) {
// use mime magic extension if available // use mime magic extension if available
$mimeType = mime_content_type($path); $mimeType = mime_content_type($path);