public static function mimeType($check, $mimeTypes = [])
    {
        $file = static::getFilename($check);
        if ($file === false) {
            return false;
        }

        if (!function_exists('finfo_open')) {
            throw new LogicException('ext/fileinfo is required for validating file mime types');
        }

        if (!is_file($file)) {
            throw new RuntimeException('Cannot validate mimetype for a missing file');
        }

        $finfo = finfo_open(FILEINFO_MIME);
        $finfo = finfo_file($finfo, $file);

        if (!$finfo) {
            throw new RuntimeException('Can not determine the mimetype.');
        }

        list($mime) = explode(';', $finfo);

        if (is_string($mimeTypes)) {
            return self::_check($mime, $mimeTypes);
        }

        foreach ($mimeTypes as $key => $val) {
            $mimeTypes[$key] = strtolower($val);
        }

        return in_array($mime, $mimeTypes);
    }