WordPress\AiClient\Files\ValueObjects
MimeType::toExtension
Gets the primary known file extension for this MIME type.
Method of the class: MimeType{}
No Hooks.
Returns
String. The file extension (without the dot).
Usage
$MimeType = new MimeType(); $MimeType->toExtension(): string;
Changelog
| Since 0.1.0 | Introduced. |
MimeType::toExtension() MimeType::toExtension code WP 7.0
public function toExtension(): string
{
// Reverse lookup for the MIME type to find the extension.
$extension = array_search($this->value, self::$extensionMap, \true);
if ($extension === \false) {
throw new InvalidArgumentException(sprintf('No known extension for MIME type: %s', $this->value));
}
return $extension;
}