Documentation

FinfoMimeTypeDetector
in package
implements MimeTypeDetector, ExtensionLookup

Interfaces, Classes and Traits

MimeTypeDetector
ExtensionLookup

Table of Contents

INCONCLUSIVE_MIME_TYPES  = ['application/x-empty', 'text/plain', 'text/x-asm', 'application/octet-stream', 'inode/x-empty']
$bufferSampleSize  : int|null
$extensionMap  : ExtensionToMimeTypeMap
$finfo  : finfo
$inconclusiveMimetypes  : array<string|int, string>
__construct()  : mixed
detectMimeType()  : string|null
detectMimeTypeFromBuffer()  : string|null
detectMimeTypeFromFile()  : string|null
detectMimeTypeFromPath()  : string|null
lookupAllExtensions()  : array<string|int, string>
lookupExtension()  : string|null
takeSample()  : string

Constants

INCONCLUSIVE_MIME_TYPES

private mixed INCONCLUSIVE_MIME_TYPES = ['application/x-empty', 'text/plain', 'text/x-asm', 'application/octet-stream', 'inode/x-empty']

Properties

Methods

__construct()

public __construct([string $magicFile = '' ][, ExtensionToMimeTypeMap $extensionMap = null ][, int|null $bufferSampleSize = null ][, array<string|int, mixed> $inconclusiveMimetypes = self::INCONCLUSIVE_MIME_TYPES ]) : mixed
Parameters
$magicFile : string = ''
$extensionMap : ExtensionToMimeTypeMap = null
$bufferSampleSize : int|null = null
$inconclusiveMimetypes : array<string|int, mixed> = self::INCONCLUSIVE_MIME_TYPES
Return values
mixed

detectMimeType()

public detectMimeType(string $path, mixed $contents) : string|null
Parameters
$path : string
$contents : mixed
Return values
string|null

detectMimeTypeFromBuffer()

public detectMimeTypeFromBuffer(string $contents) : string|null
Parameters
$contents : string
Return values
string|null

detectMimeTypeFromFile()

public detectMimeTypeFromFile(string $path) : string|null
Parameters
$path : string
Return values
string|null

detectMimeTypeFromPath()

public detectMimeTypeFromPath(string $path) : string|null
Parameters
$path : string
Return values
string|null

lookupAllExtensions()

public lookupAllExtensions(string $mimetype) : array<string|int, string>
Parameters
$mimetype : string
Return values
array<string|int, string>

lookupExtension()

public lookupExtension(string $mimetype) : string|null
Parameters
$mimetype : string
Return values
string|null

takeSample()

private takeSample(string $contents) : string
Parameters
$contents : string
Return values
string

Search results