MimeMap

MimeMapInterface extends MapInterface

Interface for MimeMap maps.

Table of Contents

Methods

__construct()  : mixed
Constructor.
addTypeAlias()  : MimeMapInterface
Adds an alias of a MIME type.
addTypeDescription()  : MimeMapInterface
Adds a description of a MIME type.
addTypeExtensionMapping()  : MimeMapInterface
Adds a type-to-extension mapping.
backup()  : void
Backs up the map array.
getAliasTypes()  : array<int, string>
Gets the parent types of an alias.
getExtensionTypes()  : array<int, string>
Gets the content of an entry from the 'extensions' array.
getFileName()  : string
Returns the map's class fully qualified filename.
getInstance()  : MapInterface
Returns the singleton.
getMapArray()  : array<string, array<int|string, array<string, array<int, string>>>>
Gets the map array.
getTypeAliases()  : array<int, string>
Gets the aliases of a MIME type.
getTypeDescriptions()  : array<int, string>
Gets the descriptions of a MIME type.
getTypeExtensions()  : array<int, string>
Gets the content of an entry from the 't' array.
hasAlias()  : bool
Determines if a MIME type alias exists.
hasExtension()  : bool
Determines if an entry exists from the 'extensions' array.
hasType()  : bool
Determines if a MIME type exists.
listAliases()  : array<int, string>
Lists all the MIME types aliases defined in the map.
listExtensions()  : array<int, string>
Lists all the extensions defined in the map.
listTypes()  : array<int, string>
Lists all the MIME types defined in the map.
removeType()  : bool
Removes the entire mapping of a type.
removeTypeAlias()  : bool
Removes a MIME type alias.
removeTypeExtensionMapping()  : bool
Removes a type-to-extension mapping.
reset()  : void
Resets the map array to the backup.
setExtensionDefaultType()  : MimeMapInterface
Changes the default MIME type for a file extension.
setTypeDefaultExtension()  : MimeMapInterface
Changes the default extension for a MIME type.
sort()  : MapInterface
Sorts the map.

Methods

addTypeDescription()

Adds a description of a MIME type.

public addTypeDescription(string $type, string $description) : MimeMapInterface
Parameters
$type : string

A MIME type.

$description : string

The description of the MIME type.

Tags
throws
MappingException

if $type is an alias.

Return values
MimeMapInterface

getAliasTypes()

Gets the parent types of an alias.

public getAliasTypes(string $alias) : array<int, string>

There should not be multiple types for an alias.

Parameters
$alias : string

The alias to be found.

Return values
array<int, string>

getExtensionTypes()

Gets the content of an entry from the 'extensions' array.

public getExtensionTypes(string $extension) : array<int, string>
Parameters
$extension : string

The extension to be found.

Return values
array<int, string>

The mapped MIME types.

getFileName()

Returns the map's class fully qualified filename.

public getFileName() : string
Return values
string

getMapArray()

Gets the map array.

public getMapArray() : array<string, array<int|string, array<string, array<int, string>>>>
Return values
array<string, array<int|string, array<string, array<int, string>>>>

getTypeAliases()

Gets the aliases of a MIME type.

public getTypeAliases(string $type) : array<int, string>
Parameters
$type : string

The type to be found.

Return values
array<int, string>

The mapped aliases.

getTypeDescriptions()

Gets the descriptions of a MIME type.

public getTypeDescriptions(string $type) : array<int, string>
Parameters
$type : string

The type to be found.

Return values
array<int, string>

The mapped descriptions.

getTypeExtensions()

Gets the content of an entry from the 't' array.

public getTypeExtensions(string $type) : array<int, string>
Parameters
$type : string

The type to be found.

Return values
array<int, string>

The mapped file extensions.

hasAlias()

Determines if a MIME type alias exists.

public hasAlias(string $alias) : bool
Parameters
$alias : string

The alias to be found.

Return values
bool

hasExtension()

Determines if an entry exists from the 'extensions' array.

public hasExtension(string $extension) : bool
Parameters
$extension : string

The extension to be found.

Return values
bool

hasType()

Determines if a MIME type exists.

public hasType(string $type) : bool
Parameters
$type : string

The type to be found.

Return values
bool

listAliases()

Lists all the MIME types aliases defined in the map.

public listAliases([string $match = null ]) : array<int, string>
Parameters
$match : string = null

(Optional) a match wildcard to limit the list.

Return values
array<int, string>

listExtensions()

Lists all the extensions defined in the map.

public listExtensions([string $match = null ]) : array<int, string>
Parameters
$match : string = null

(Optional) a match wildcard to limit the list.

Return values
array<int, string>

listTypes()

Lists all the MIME types defined in the map.

public listTypes([string $match = null ]) : array<int, string>
Parameters
$match : string = null

(Optional) a match wildcard to limit the list.

Return values
array<int, string>

removeType()

Removes the entire mapping of a type.

public removeType(string $type) : bool
Parameters
$type : string

A MIME type.

Return values
bool

true if the mapping was removed, false if the type was not present.

removeTypeAlias()

Removes a MIME type alias.

public removeTypeAlias(string $type, string $alias) : bool
Parameters
$type : string

A MIME type.

$alias : string

The alias to be removed.

Return values
bool

true if the alias was removed, false if the alias was not present.

removeTypeExtensionMapping()

Removes a type-to-extension mapping.

public removeTypeExtensionMapping(string $type, string $extension) : bool
Parameters
$type : string

A MIME type.

$extension : string

The file extension to be removed.

Return values
bool

true if the mapping was removed, false if the mapping was not present.

reset()

Resets the map array to the backup.

public reset() : void

setExtensionDefaultType()

Changes the default MIME type for a file extension.

public setExtensionDefaultType(string $extension, string $type) : MimeMapInterface

Allows a MIME type alias to be set as default for the extension.

Parameters
$extension : string

A file extension.

$type : string

A MIME type.

Tags
throws
MappingException

if no mapping found.

Return values
MimeMapInterface

setTypeDefaultExtension()

Changes the default extension for a MIME type.

public setTypeDefaultExtension(string $type, string $extension) : MimeMapInterface
Parameters
$type : string

A MIME type.

$extension : string

A file extension.

Tags
throws
MappingException

if no mapping found.

Return values
MimeMapInterface

        
On this page

Search results