Commit 15043348 authored by Taylor Otwell's avatar Taylor Otwell

refactoring file class.

parent 0a2ce4e8
...@@ -74,6 +74,13 @@ class File { ...@@ -74,6 +74,13 @@ class File {
/** /**
* Get a file MIME type by extension. * Get a file MIME type by extension.
* *
* Any extension in the MIMEs configuration file may be passed to the method.
*
* <code>
* // Returns "application/x-tar"
* $mime = File::mime('tar');
* </code>
*
* @param string $extension * @param string $extension
* @param string $default * @param string $default
* @return string * @return string
...@@ -93,9 +100,17 @@ class File { ...@@ -93,9 +100,17 @@ class File {
/** /**
* Determine if a file is a given type. * Determine if a file is a given type.
* *
* The Fileinfo PHP extension will be used to determine the MIME type * The Fileinfo PHP extension will be used to determine the MIME type of the file. Any extension
* of the file. Any extension in the mimes configuration array may * in the MIMEs configuration file may be passed as a type.
* be passed as a type. *
* <code>
* // Determine if the file is a JPG image
* $image = File::is('jpg', 'path/to/image.jpg');
* </code>
*
* @param string $extension
* @param string $path
* @return bool
*/ */
public static function is($extension, $path) public static function is($extension, $path)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment