MimeTypeAlias
The other names a file format is known by, each mapped to the name {@see FileMimeType} uses.
A format often carries several MIME type names : finfo reports audio/x-wav for a WAV file
where the catalogue knows audio/wav, text/xml for an XML document where it knows
application/xml. Read as different strings, the same file would get no extension from
FileMimeType::getExtension() and would be refused by
validateMimeType() against a list naming the format the other way.
normalizeMimeType() reads this table to bring every name back to one.
Each alias names the same format as its reference : normalizing never lets one format pass
for another. The table is a constant of its own class, not of FileMimeType : the
constants of a class using ConstantsTrait are all read as MIME types.
Tags
Table of Contents
Constants
- ALIASES : array<string|int, mixed> = [ // Reported by finfo for these formats (measu...
- The alias names, lower-case, each mapped to its reference name.
- UNKNOWN_BINARY : string = 'application/octet-stream'
- The type `finfo` reports for a content it does not recognize : bytes, with no format to tell.
Constants
ALIASES
The alias names, lower-case, each mapped to its reference name.
public
array<string|int, mixed>
ALIASES
= [
// Reported by finfo for these formats (measured on PHP 8.4, fileinfo 8.4).
'audio/x-hx-aac-adts' => \oihana\files\enums\FileMimeType::AAC,
'audio/x-wav' => \oihana\files\enums\FileMimeType::WAV,
'text/xml' => \oihana\files\enums\FileMimeType::XML,
// Declared by browsers for a voice recording : finfo reports `video/webm` for the same
// container, which holds sound only or sound and pictures alike.
'audio/webm' => \oihana\files\enums\FileMimeType::WEBM,
// Older names, still reported by some magic databases or declared by some clients.
'application/x-gzip' => \oihana\files\enums\FileMimeType::GZ,
'audio/vnd.wave' => \oihana\files\enums\FileMimeType::WAV,
'audio/wave' => \oihana\files\enums\FileMimeType::WAV,
'audio/x-aac' => \oihana\files\enums\FileMimeType::AAC,
'audio/x-flac' => \oihana\files\enums\FileMimeType::FLAC,
'image/x-ms-bmp' => \oihana\files\enums\FileMimeType::BMP,
]
UNKNOWN_BINARY
The type `finfo` reports for a content it does not recognize : bytes, with no format to tell.
public
string
UNKNOWN_BINARY
= 'application/octet-stream'