Elgg  Version master
Public Member Functions | Protected Attributes | List of all members
Elgg\Filesystem\MimeTypeService Class Reference

Public service related to MIME type detection. More...

Public Member Functions

 __construct (PluginHooksService $hooks)
 Constructor. More...
 
 getMimeType (string $filename, string $default=MimeTypeDetector::DEFAULT_TYPE)
 Get the mimetype for a given filename. More...
 
 getSimpleType (string $mimetype, string $default= 'general')
 Returns the category of a file from its MIME type. More...
 
 getSimpleTypeFromFile (string $filename, string $default= 'general')
 Returns the category of a file from a filename. More...
 

Protected Attributes

 $hooks
 

Detailed Description

Public service related to MIME type detection.

Since
3.3

Definition at line 13 of file MimeTypeService.php.

Constructor & Destructor Documentation

Elgg\Filesystem\MimeTypeService::__construct ( PluginHooksService  $hooks)

Constructor.

Parameters
PluginHooksService$hooksPlugin hooks service

Definition at line 22 of file MimeTypeService.php.

Member Function Documentation

Elgg\Filesystem\MimeTypeService::getMimeType ( string  $filename,
string  $default = MimeTypeDetector::DEFAULT_TYPE 
)

Get the mimetype for a given filename.

Parameters
string$filenameFilename to check
string$defaultDefault mimetype if not detected (default: application/octet-stream)
Exceptions
InvalidArgumentException
Returns
string

Definition at line 35 of file MimeTypeService.php.

Elgg\Filesystem\MimeTypeService::getSimpleType ( string  $mimetype,
string  $default = 'general' 
)

Returns the category of a file from its MIME type.

Parameters
string$mimetypeThe MIME type
string$defaultDefault MIME type if detection fails (default: general)
Returns
string

Definition at line 61 of file MimeTypeService.php.

Elgg\Filesystem\MimeTypeService::getSimpleTypeFromFile ( string  $filename,
string  $default = 'general' 
)

Returns the category of a file from a filename.

Parameters
string$filenameThe filename to check
string$defaultDefault MIME type if detection fails (default: general)
Returns
string

Definition at line 98 of file MimeTypeService.php.

Member Data Documentation

Elgg\Filesystem\MimeTypeService::$hooks
protected

Definition at line 15 of file MimeTypeService.php.


The documentation for this class was generated from the following file: