WordPress\AiClient\Files\ValueObjects

MimeType::toExtension │ public │ WP 0.1.0

Gets the primary known file extension for this MIME type.

Метод класса: MimeType{}

Хуков нет.

Возвращает

string. The file extension (without the dot).

Использование

$MimeType = new MimeType();
$MimeType->toExtension(): string;

Список изменений

С версии 0.1.0 Введена.

Код MimeType::toExtension() WP 7.1.2

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;
}