Skip to content

Commit

Permalink
Cleanup cs278's commits for coding style and fix a bug preventing tra…
Browse files Browse the repository at this point in the history
…nsparant extension. refs #3167
  • Loading branch information
kiall committed Dec 6, 2010
1 parent ff86907 commit 0c1e4b4
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions classes/kohana/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ public static function mimes_by_ext($extension)
/**
* Lookup file extensions by MIME type
*
* @staticvar array $types Cache of MIME to extension mappings
* @param string $type File MIME type
* @return array File extensions matching MIME type
* @param string $type File MIME type
* @return array File extensions matching MIME type
*/
public static function exts_by_mime($type)
{
Expand All @@ -117,31 +116,30 @@ public static function exts_by_mime($type)
continue;
}

if (!isset($types[$mime]))
if ( ! isset($types[$mime]))
{
$types[$mime] = array((string) $ext);
}
else if (!in_array($ext, $types[$mime]))
else if ( ! in_array($ext, $types[$mime]))
{
$types[$mime][] = (string) $ext;
}
}
}
}

return isset($types[$type]) ? $types[$type] : false;
return isset($types[$type]) ? $types[$type] : FALSE;
}

/**
* Lookup a single file extension by MIME type.
*
* @uses File::exts_by_mime()
* @param string $type MIME type to lookup
* @return mixed First file extension matching or false
* @param string $type MIME type to lookup
* @return mixed First file extension matching or false
*/
public static function ext_by_mime($type)
{
return current(self::exts_by_mime($type));
return current(File::exts_by_mime($type));
}

/**
Expand Down

0 comments on commit 0c1e4b4

Please sign in to comment.