(non-PHPdoc)

@see ResourceInterface::getMimetype()
544852
public function getMimetype()
	{
		if (is_null($this->mimetype)) {
			$ext = pathinfo($this->path, PATHINFO_EXTENSION);
			if ($ext === 'css') {
				return 'text/css';
			}
			if ($ext === 'js') {
				return 'text/javascript';
			}
			$guesser = MimeTypeGuesser::getInstance();
			$this->mimetype = $guesser->guess($this->getPath());
		}
		return $this->mimetype;
	}
1147916
public static function getMimeType($extension)
    {
        if (!isset(self::$mimeTypes[$extension])) {
            return null;
        }

        return self::$mimeTypes[$extension];
    }
227515
public static function getMimeTypeByFile(string $file)
    {
        if (!\is_file($file) || !\class_exists('\finfo', false)) {
            return null;
        }

        try {
            $finfo = new \finfo(FILEINFO_MIME_TYPE);

            return $finfo->file($file) ?: null;
            // @codeCoverageIgnoreStart
        } catch (\ErrorException $e) {
            // This is caused by an array to string conversion error.
            return null;
        }
    }
1215804
public function getMimeType()
    {
        if ($this->exists()) {
            $finfo = new \finfo(FILEINFO_MIME_TYPE | FILEINFO_PRESERVE_ATIME);
            $mime = $finfo->file($this->getRealPath());
            return $mime;
        }
        return null;
    }
510924
public static function getMimetype(string $file): string
    {
        $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
        $mimetype = finfo_file($finfo, $file);
        finfo_close($finfo);
        
        return $mimetype;
    }
742679
public static function getByMimeType(?string $mimeType): int
    {
        switch (explode('/', (string) $mimeType)[0] ?? null) {
            case 'image':
                return static::IMAGE;
            case 'audio':
                return static::AUDIO;
            case 'video':
                return static::VIDEO;
            default:
                return static::FILE;
        }
    }
1261048
public function fileMimeType()
    {
        try {
            $mimeType = $this->storage->mimeType($this->blob->path);
        } catch (\Exception $ex) {
            $ext = pathinfo($this->blob->path, PATHINFO_EXTENSION);
            $mimeType = BlobMetadata::guessMimeType($ext, !!$ext);
        }

        return $mimeType;
    }
1294708
public static function getMimeType($file)
    {
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $type = finfo_file($finfo, $file);
        finfo_close($finfo);

        return $type;
    }
93064
public function getMimeType($format) {

		if (NULL === static::$formats) {
			static::initializeFormats();
		}

		return isset(static::$formats[$format]) ? static::$formats[$format][0] : NULL;

	}
1185552
public function get_mimetype() {
        if ($this->singlefile instanceof stored_file) {
            return $this->singlefile->get_mimetype();
        } else if (!empty($this->intendedmimetype)) {
            return $this->intendedmimetype;
        }
    }
944244
private function getMimeType($data, $isFilename = false)
    {
        if (extension_loaded('fileinfo')) {
            $finfo = new \finfo(FILEINFO_MIME);
            if ($isFilename !== false) {
                return $finfo->file($data);
            }
            return $finfo->buffer($data);
        }
        return false;
    }
771588
public function getMimeTypeFromExtension($extension) {
        return isset($this->extensionToMimeType[$extension]) ? $this->extensionToMimeType[$extension] : null;
    }
492628
public MimeType getMimeType() {
		if (format >= 0 && format < MIME_TYPE_STRINGS.length) {
			if (format == FORMAT_JPEG && progressive)
			{
				return new MimeType("image/pjpeg");
			}
			return new MimeType(MIME_TYPE_STRINGS[format]);
		} else {
			return null;
		}
	}
636141
static public function getMimeType($contentType, $filename=null)
    {
        if ($contentType = strtolower($contentType)) {
            if (strpos($contentType, '/') !== false) {
                $mimeTypes = array_keys(self::$mime_types, $contentType);
                $ext = $filename ? pathinfo($filename, PATHINFO_EXTENSION) : null;
                
                if (count($mimeTypes) === 1) {
                    return $mimeTypes[0];
                } elseif (count($mimeTypes) > 1) {
                    return $ext && in_array($ext, $mimeTypes) ? $ext : $mimeTypes[0];
                } else {
                    return $ext ? static::getMimeType($ext) : null;
                }
            } else {
                $ext = pathinfo($contentType, PATHINFO_EXTENSION);
                if (isset(static::$mime_types[$ext])) {
                    return $ext;
                }
            }
        } elseif ($filename) {
            return static::getMimeType($filename);
        }
        
        return null;
    }
1143922
public function getMimetype($path)
    {
        $stat = $this->getMetadata($path);

        return isset($stat['custom_headers']['Content-Type'])
            ? ['mimetype' => $stat['custom_headers']['Content-Type']] : false;
    }
1347974
public static function getMimetype($filename): string
    {
        $extension = pathinfo($filename, PATHINFO_EXTENSION);
        $extension = strtolower($extension);
        return !empty(self::$mimetypes[$extension]) ? self::$mimetypes[$extension] : '';
    }
1288295
public function getMimetype($path)
    {
        $metadata = $this->read($path);

        if ($metadata === false) {
            return false;
        }

        $metadata['mimetype'] = Util::guessMimeType($path, $metadata['contents']);

        return $metadata;
    }