Adds the mimetypes

@param  string|array $mimetype The mimetypes to add for validation
@return Zend_Validate_File_Extension Provides a fluent interface
779252
public function addMimeType($mimetype)
    {
        $mimetypes = $this->getMimeType(true);

        if (is_string($mimetype)) {
            $mimetype = explode(',', $mimetype);
        } elseif (!is_array($mimetype)) {

            throw new Zend_Validate_Exception("Invalid options to validator provided");
        }

        if (isset($mimetype['magicfile'])) {
            unset($mimetype['magicfile']);
        }

        foreach ($mimetype as $content) {
            if (empty($content) || !is_string($content)) {
                continue;
            }
            $mimetypes[] = trim($content);
        }
        $mimetypes = array_unique($mimetypes);

        // Sanity check to ensure no empty values
        foreach ($mimetypes as $key => $mt) {
            if (empty($mt)) {
                unset($mimetypes[$key]);
            }
        }

        $this->_mimetype = implode(',', $mimetypes);

        return $this;
    }
837503
public function setMimeType(string $mime_type)
    {
        if (!preg_match('/^[\w_-]+\/[\w_-]+$/', $mime_type))
            throw new \InvalidArgumentException("Not a valid mime type: $mime_type");
        $this->mime_type = $mime_type;
        return $this;
    }
379
public function getExtension($mimetype)
    {
        if (!($extension = array_search($mimetype, $this->mainMimeTypes))) {
            $extension = array_search($mimetype, $this->mimeTypes);
        }

        return !$extension ? null : $extension;
    }
1176444
public function read($uri, $mimeType = null)
    {
        return $this->schemaFactory()->create(
            $this->reader()->read($uri, $mimeType)
        );
    }
1311773
protected function createMimetypeFile()
    {
        $this->createFileWithContents($this->rootFolder, self::MIMETYPE_FILE_NAME, self::MIMETYPE);
        return $this;
    }
208968
public function classFor(string $mimeType)
    {
        if ($this->provideClass($mimeType)) {
            return $this->mimeTypeClasses[$mimeType];
        }

        return null;
    }
926447
protected function replaceExtension($filename, $mimeType)
    {
        $info = pathinfo($filename);

        switch ($mimeType) {
            case 'image/png':
            case 'image/svg+xml':
                $extension = 'png';
                break;
            case 'image/gif':
                $extension = 'gif';
                break;
            default:
                $extension = 'jpg';
        }

        return $info['filename'] . '.' . $extension;
    }
666138
private function setMimeType(FileMimeType $aMimeType)
    {
        if (!in_array($aMimeType->mimeType(), $this->availableMimeTypes(), true)) {
            throw new FileMimeTypeDoesNotSupportException();
        }
        $this->mimeType = $aMimeType;
    }
300611
public function setMimeType($mimeType)
    {
        if ($mimeType != $this->getMimeType()) {
            // ensure that we got an internal imagine image
            $this->getImagineImage();
            $this->mimeType = $mimeType;
            $this->binaryContentDirty = true;
        }
    }
1319980
protected function checkMimeType($mimeType)
    {
        $allow = $this->getWhitelistedMimeTypes();
        $block = $this->getBlacklistedMimeTypes();

        if (false !== $allow) {
            foreach ($allow as $pattern) {
                if ($this->wildCardMatch($mimeType, $pattern)) {
                    return true;
                }
            }

            return false;
        }

        if (false !== $block) {
            foreach ($block as $pattern) {
                if ($this->wildCardMatch($mimeType, $pattern)) {
                    return false;
                }
            }
        }

        return true;
    }
153650
static function changeMIMEType( &$mimeInfo, $mimetype )
    {
        $mimeInfo['name'] = $mimetype;
        $newMimeInfo = eZMimeType::findByName( $mimetype );
        $mimeInfo['suffixes'] = $newMimeInfo['suffixes'];
        $mimeInfo['prefixes'] = $newMimeInfo['prefixes'];
        $mimeInfo['suffix'] = $newMimeInfo['suffix'];
        $mimeInfo['prefix'] = $newMimeInfo['prefix'];
        $filename = $mimeInfo['filename'];
        $dotPosition = strrpos( $filename, '.' );
        $basename = $filename;
        if ( $dotPosition !== false )
            $basename = substr( $filename, 0, $dotPosition );
        $mimeInfo['filename'] = $basename . '.' . $mimeInfo['suffix'];
        if ( $mimeInfo['dirpath'] )
            $mimeInfo['url'] = $mimeInfo['dirpath'] . '/' . $mimeInfo['filename'];
        else
            $mimeInfo['url'] = $mimeInfo['filename'];
    }
844392
public static function getExtensions(array $mimetypes)
    {
        $extensions = [];
        foreach ($mimetypes as $mimetype) {
            $extension = static::getExtensionByMime($mimetype, false);
            if ($extension && !\in_array($extension, $extensions, true)) {
                $extensions[] = $extension;
            }
        }

        return $extensions;
    }
122674
def add_mimetype(mimedb, mimetype, extension):
    """"""
    # If extension is already a common type, strict=True must be used.
    strict = extension in mimedb.types_map[True]
    mimedb.add_type(mimetype, extension, strict=strict)
153805
public function matchMimetypeExtension($mimetype, $extension)
    {
        $mime_extensions = self::$mimetypes_extensions;
        if (isset($mime_extensions[$extension]) && $mime_extensions[$extension] == $mimetype) {
            return true;
        }

        return false;
    }
815273
public static function isFileMimeType($mimetype, $file) {
        if (!extension_loaded('fileinfo'))
            throw new \Exception('fileinfo extension not loaded try change your PHP configuration');

        if (!is_file(realpath($file)) || !file_exists(realpath($file)) || !is_readable(realpath($file)))
            throw new \Exception('La vérification du mimetype du fichier "' . $file . '" à échoué, le fichier n\'existe pas ou est invalid');

        $finfo = new \finfo(FILEINFO_MIME_TYPE);
        return (strpos($finfo->file(realpath($file)), $mimetype) !== false) ? true : false;
    }
445944
public function getMediaType($mimetype)
    {
        foreach ($this->mediaTypes as $type => $mimeTypes)
        {
            if (in_array($mimetype, $mimeTypes))
            {
                return $type;
            }
        }

        return null;
    }
44950
public function setFormat($format, $mimeTypes) {

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

		static::$formats[$format] = is_array($mimeTypes) ? $mimeTypes : array($mimeTypes);

	}