Gets the format associated with the mime type.
@api
string $mimeType The associated mime type:
string|null The format (null if not found)
public function getFormat($mimeType) {
if (false !== ($pos = strpos($mimeType, ';'))) {
$mimeType = substr($mimeType, 0, $pos);
}
if (null === static::$formats) {
static::initializeFormats();
}
foreach (static::$formats as $format => $mimeTypes) {
if (in_array($mimeType, (array) $mimeTypes)) {
return $format;
}
}
return null;
}