class Todo2311679 in ImageMagick 8
Makes possible to guess the MIME type of a file using its extension.
Hierarchy
- class \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser implements \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface
- class \Drupal\imagemagick\Todo2311679
Expanded class hierarchy of Todo2311679
1 string reference to 'Todo2311679'
1 service uses Todo2311679
File
- src/
Todo2311679.php, line 15
Namespace
Drupal\imagemagickView source
class Todo2311679 extends ExtensionMimeTypeGuesser {
public function getExtensionsForMimeType($mimetype) {
if ($this->mapping === NULL) {
$mapping = $this->defaultMapping;
// Allow modules to alter the default mapping.
$this->moduleHandler
->alter('file_mimetype_mapping', $mapping);
$this->mapping = $mapping;
}
if (!in_array($mimetype, $this->mapping['mimetypes'])) {
return [];
}
$key = array_search($mimetype, $this->mapping['mimetypes']);
$extensions = array_keys($this->mapping['extensions'], $key, TRUE);
sort($extensions);
return $extensions;
}
public function getMimeTypes() {
if ($this->mapping === NULL) {
$mapping = $this->defaultMapping;
// Allow modules to alter the default mapping.
$this->moduleHandler
->alter('file_mimetype_mapping', $mapping);
$this->mapping = $mapping;
}
return array_values($this->mapping['mimetypes']);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExtensionMimeTypeGuesser:: |
protected | property | Default MIME extension mapping. | |
ExtensionMimeTypeGuesser:: |
protected | property | The MIME types mapping array after going through the module handler. | |
ExtensionMimeTypeGuesser:: |
protected | property | The module handler. | |
ExtensionMimeTypeGuesser:: |
public | function | Guesses the mime type of the file with the given path. | |
ExtensionMimeTypeGuesser:: |
public | function | Sets the mimetypes/extension mapping to use when guessing mimetype. | |
ExtensionMimeTypeGuesser:: |
public | function | Constructs a new ExtensionMimeTypeGuesser. | |
Todo2311679:: |
public | function | ||
Todo2311679:: |
public | function |