PHP Class Elgg\Filesystem\MimeTypeDetector

Mostrar archivo Open project: elgg/elgg

Public Properties

Property Type Description
$extensions array
$strategies callable[]
$use_extension boolean

Public Methods

Method Description
fixDetectionErrors ( string $type, string $extension ) : string Fix common type detection errors
getType ( string $file, string $default = self::DEFAULT_TYPE ) : string Sniff the MIME type
tryFile ( string $file ) : string Detect MIME type using file(1)
tryFinfo ( string $file ) : string Detect MIME type using finfo_open
tryGetimagesize ( string $file ) : string Detect MIME type
tryMimeContentType ( string $file ) : string Detect MIME type using mime_content_type
tryStrategies ( string $file ) : string Detect MIME type using various strategies

Method Details

fixDetectionErrors() public method

Fix common type detection errors
public fixDetectionErrors ( string $type, string $extension ) : string
$type string MIME type detected
$extension string Filename extensions
return string Fixed MIME type

getType() public method

Sniff the MIME type
public getType ( string $file, string $default = self::DEFAULT_TYPE ) : string
$file string File path
$default string Default type to return on failure
return string MIME type

tryFile() public static method

Detect MIME type using file(1)
public static tryFile ( string $file ) : string
$file string File path
return string Type detected. Empty string on failure

tryFinfo() public static method

Detect MIME type using finfo_open
public static tryFinfo ( string $file ) : string
$file string File path
return string Type detected. Empty string on failure

tryGetimagesize() public static method

Detect MIME type
public static tryGetimagesize ( string $file ) : string
$file string File path
return string Type detected. Empty string on failure

tryMimeContentType() public static method

Detect MIME type using mime_content_type
public static tryMimeContentType ( string $file ) : string
$file string File path
return string Type detected. Empty string on failure

tryStrategies() public method

Detect MIME type using various strategies
public tryStrategies ( string $file ) : string
$file string File path
return string Type detected. Empty string on failure

Property Details

$extensions public_oe property

public array $extensions
return array

$strategies public_oe property

public callable[] $strategies
return callable[]

$use_extension public_oe property

public bool $use_extension
return boolean