MimeType::isType( string $mimeType ): bool

Checks if this MIME type is a specific type.

Description

This method returns true when the stored MIME type begins with the given prefix. For example, "audio" matches "audio/mpeg".

Parameters

$mimeTypestringrequired
The MIME type prefix to check (e.g., "audio", "image").

Return

bool True if this MIME type is of the specified type.

Source

public function isType(string $mimeType): bool
{
    return str_starts_with($this->value, strtolower($mimeType) . '/');
}

Changelog

VersionDescription
0.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.