MimeMap

BaseMap
in package
implements MapInterface

AbstractYes

Abstract base class for managing MimeMap maps.

This class cannot be instantiated.

Table of Contents

Interfaces

MapInterface
Interface for maps.

Properties

$backupMap  : array<string, array<int|string, array<string, array<int, string>>>>|null
A backup of the mapping between file extensions and MIME types.
$instance  : MapInterface|null
Singleton instance.
$map  : array<string, array<int|string, array<string, array<int, string>>>>
Mapping between file extensions and MIME types.

Methods

__construct()  : mixed
Constructor.
backup()  : void
Backs up the map 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.
reset()  : void
Resets the map array to the backup.
sort()  : MapInterface
Sorts the map.
addMapSubEntry()  : MapInterface
Adds an entry to the map.
getMapEntry()  : array<string, array<string|int, string>>
Gets the content of an entry of the map.
getMapSubEntry()  : array<int, string>
Gets the content of a subentry of the map.
listEntries()  : array<int, int|string>
Gets a list of entries of the map.
removeMapSubEntry()  : bool
Removes an entry from the map.
setValueAsDefault()  : MapInterface
Sets a value as the default for an entry.

Properties

$backupMap

A backup of the mapping between file extensions and MIME types.

protected static array<string, array<int|string, array<string, array<int, string>>>>|null $backupMap

Used during the map update process.

$map

Mapping between file extensions and MIME types.

protected static array<string, array<int|string, array<string, array<int, string>>>> $map = []

Methods

__construct()

Constructor.

public __construct() : mixed

backup()

Backs up the map array.

public backup() : void

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>>>>

reset()

Resets the map array to the backup.

public reset() : void

addMapSubEntry()

Adds an entry to the map.

protected addMapSubEntry(string $entry, string $entryKey, string $subEntry, string $value) : MapInterface

Checks that no duplicate entries are made.

Parameters
$entry : string

The main array entry.

$entryKey : string

The main entry value.

$subEntry : string

The sub entry.

$value : string

The value to add.

Return values
MapInterface

getMapEntry()

Gets the content of an entry of the map.

protected getMapEntry(string $entry, string $entryKey) : array<string, array<string|int, string>>
Parameters
$entry : string

The main array entry.

$entryKey : string

The main entry value.

Return values
array<string, array<string|int, string>>

The values of the entry, or empty array if missing.

getMapSubEntry()

Gets the content of a subentry of the map.

protected getMapSubEntry(string $entry, string $entryKey, string $subEntry) : array<int, string>
Parameters
$entry : string

The main array entry.

$entryKey : string

The main entry value.

$subEntry : string

The sub entry.

Return values
array<int, string>

The values of the subentry, or empty array if missing.

listEntries()

Gets a list of entries of the map.

protected listEntries(string $entry[, string|null $match = null ]) : array<int, int|string>
Parameters
$entry : string

The main array entry.

$match : string|null = null

(Optional) a match wildcard to limit the list.

Return values
array<int, int|string>

The list of the entries.

removeMapSubEntry()

Removes an entry from the map.

protected removeMapSubEntry(string $entry, string $entryKey, string $subEntry, string $value) : bool
Parameters
$entry : string

The main array entry.

$entryKey : string

The main entry value.

$subEntry : string

The sub entry.

$value : string

The value to remove.

Return values
bool

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

setValueAsDefault()

Sets a value as the default for an entry.

protected setValueAsDefault(string $entry, string $entryKey, string $subEntry, string $value) : MapInterface
Parameters
$entry : string

The main array entry.

$entryKey : string

The main entry value.

$subEntry : string

The sub entry.

$value : string

The value to add.

Tags
throws
MappingException

if no mapping found.

Return values
MapInterface

        
On this page

Search results