protected function ImagemagickMimeTypeMapper::getMapping in ImageMagick 8.2
Returns the MIME types mapping array from ExtensionMimeTypeGuesser.
Copied via Reflection from \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser.
Return value
array The MIME types mapping array.
1 call to ImagemagickMimeTypeMapper::getMapping()
- ImagemagickMimeTypeMapper::getExtensionsForMimeType in src/
ImagemagickMimeTypeMapper.php - Returns the appropriate extensions for a given MIME type.
File
- src/
ImagemagickMimeTypeMapper.php, line 50
Class
- ImagemagickMimeTypeMapper
- Maps MIME types to file extensions.
Namespace
Drupal\imagemagickCode
protected function getMapping() {
if (!$this->mapping) {
// Guess a fake file name just to ensure the guesser loads any mapping
// alteration through the hooks.
$this->mimeTypeGuesser
->guess('fake.png');
// Use Reflection to get a copy of the protected $mapping property in the
// guesser class. Get the proxied service first, then the actual mapping.
$reflection = new \ReflectionObject($this->mimeTypeGuesser);
$proxied_service = $reflection
->getProperty('service');
$proxied_service
->setAccessible(TRUE);
$service = $proxied_service
->getValue(clone $this->mimeTypeGuesser);
$reflection = new \ReflectionObject($service);
$reflection_mapping = $reflection
->getProperty('mapping');
$reflection_mapping
->setAccessible(TRUE);
$this->mapping = $reflection_mapping
->getValue(clone $service);
}
return $this->mapping;
}