You are here

public function MimeMapManager::getType in Sophron 8

Gets a MIME type.

Parameters

string $type: A MIME type string.

Return value

\FileEye\MimeMap\Type A Type object.

Overrides MimeMapManagerInterface::getType

See also

\FileEye\MimeMap\Type

File

src/MimeMapManager.php, line 153

Class

MimeMapManager
Provides a sensible mapping between filename extensions and MIME types.

Namespace

Drupal\sophron

Code

public function getType($type) {
  try {
    return new Type($type, $this
      ->getMapClass());
  } catch (MalformedTypeException $e) {
    return NULL;
  } catch (MappingException $e) {
    return NULL;
  }
}