SymfonyComponentHttpFoundationFileMimeTypeExtensionGuesser

A singleton mime type to file extension guesser.

A default guesser is provided. You can register custom guessers by calling the register() method on the singleton instance.

$guesser = ExtensionGuesser::getInstance(); $guesser->register(new MyCustomExtensionGuesser());

The last registered guesser is preferred over previously registered ones.

Summary

No public properties found
No constants found
No protected methods found
N/A
File
vendorSymfonyComponentHttpFoundationFileMimeTypeExtensionGuesser.php
Package
Default
Class hierarchy
SymfonyComponentHttpFoundationFileMimeTypeExtensionGuesser
Implements
SymfonyComponentHttpFoundationFileMimeTypeExtensionGuesserInterface

Tags

None found

Properties

$guessers

$guessers : array

All registered ExtensionGuesserInterface instances

Type

array

Tags

None found

$instance

$instance : \Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser

The singleton instance

Type

SymfonyComponentHttpFoundationFileMimeTypeExtensionGuesser

Tags

None found

Methods

getInstance()

getInstance() : \Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser

Returns the singleton instance

Returns

SymfonyComponentHttpFoundationFileMimeTypeExtensionGuesser

static

Tags

None found

register()

register(\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface  $guesser) 

Registers a new extension guesser

When guessing, this guesser is preferred over previously registered ones.

Parameters

SymfonyComponentHttpFoundationFileMimeTypeExtensionGuesserInterface $guesser

Tags

None found

guess()

guess(string  $mimeType) : string

Tries to guess the extension

The mime type is passed to each registered mime type guesser in reverse order of their registration (last registered is queried first). Once a guesser returns a value that is not NULL, this method terminates and returns the value.

Parameters

string $mimeType

The mime type

Returns

string —

The guessed extension or NULL, if none could be guessed

Tags

None found

__construct()

__construct() 

Registers all natively provided extension guessers

Tags

None found