Récupère des mimestypes à partir d'une liste d'extensions.

@param string[] $extensions Liste d'extensions.

@return array|bool Retourne un tableau de mimestype ou 1 en cas d'erreur.
960280
protected function getMimesByExtensions(array $extensions)
    {
        $output = [];
        foreach ($extensions as $ext) {
            if (($mime = $this->getMimeByExtension($ext)) === false) {
                return false;
            }
            if (is_array($mime)) {
                $output = array_merge($output, $mime);
            } else {
                $output[] = $mime;
            }
        }

        return $output;
    }
203660
public static function getTypeForExtension($extension) {
		static::ensureDataLoaded();

		$extension = strtolower($extension);
		foreach (static::$mime_types as $mime_type => $extensions) {
			if (is_array($extensions)) {
				if (in_array($extension, $extensions, true)) {
					return $mime_type;
				}
			} else if ($extension === $extensions) {
				return $mime_type;
			}
		}
	}
125078
public function addExtensions($extensions): self
    {
        $this->fileExtensions = \array_unique(\array_merge($this->fileExtensions, \array_map('strtolower', (array) $extensions)));
        
        return $this;
    }
1219397
protected function getMimeByExtension($extension)
    {
        if (!isset($this->mimetypes[ $extension ])) {
            $this->addReturn('file_mimes', 'error_mimes', [ ':ext' => $extension ]);

            return false;
        }

        return $this->mimetypes[ $extension ];
    }
1147916
public static function getMimeType($extension)
    {
        if (!isset(self::$mimeTypes[$extension])) {
            return null;
        }

        return self::$mimeTypes[$extension];
    }
259959
protected function paymentMethodToOptions(array $extensions)
    {
        $results = array();
        $registry = $this->getRegistry();
        $directory = !$registry->isOc1() ? 'extension/payment/' : 'payment/';
        foreach ($extensions as $extension) {
            $registry->language->load($directory . $extension);
            $results[$extension] = $registry->language->get('heading_title');
        }
        return $results;
    }
1078364
public static function GetMimeTypeByExt ($ext) {
		$ext = strtolower($ext);
		$mime_type_map = static::GetMimeTypeMapForExt();
		return isset($mime_type_map[$ext]) ? $mime_type_map[$ext] : static::MIME_TYPE_BINARY;
	}
1328892
public function addImplicitExtensions(array $extensions)
    {
        $this->addExtensions($extensions);

        foreach ($extensions as $rule => $extension) {
            $this->implicitRules[] = Str::studly($rule);
        }
    }
297389
public static function for_extensions($extensions)
    {
        foreach ($extensions as $extension) {
            if ($formatter = self::for_extension($extension)) {
                return $formatter;
            }
        }

        return false;
    }
213111
public static function detectByFileExtension($extension)
	{
		static $extensionToMimeTypeMap;

		if (!$extensionToMimeTypeMap)
		{
			$extensionToMimeTypeMap = static::getExtensionToMimeTypeMap();
		}

		if (isset($extensionToMimeTypeMap[$extension]))
		{
			return $extensionToMimeTypeMap[$extension];
		}
	}
498309
public static function getExtensionsFromMime($mime, $all = false)
    {
        self::initMimeTypes();

        $result = $all ? [] : '';

        foreach (self::$mimeTypes as $ext => $mimeType)
        {
            if ($mime == $mimeType)
            {
                if ($all)
                {
                    $result[] = $ext;
                }
                else
                {
                    $result = $ext;
                    break;
                }
            }
        }
        return $result;
    }
1020029
public function MapExtensionToMimeType($mime_type, $extension)
    {
        if (!isset($this->mime_type_to_extensions[$mime_type])) {
            $this->mime_type_to_extensions[$mime_type] = array($extension);
        } else {
            $this->mime_type_to_extensions[$mime_type][] = $extension;
        }

        return true;
    }
1283711
private function validMimeImage($extension, $mimes)
    {
        if (is_array($mimes)) {
            foreach ($mimes as $mime) {
                if (!strstr($mime, 'image/')) {
                    throw new \InvalidArgumentException(htmlspecialchars(
                        "The extension $extension is not an image extension."
                    ));
                }
            }
        } else {
            if (!strstr($mimes, 'image/')) {
                throw new \InvalidArgumentException(htmlspecialchars(
                    "The extension $extension is not an image extension."
                ));
            }
        }
    }
923124
private function loadExtensions($extensions)
    {
        $extensions = Arr::wrap($extensions);

        foreach ($extensions as $extension) {
            $extension = 'ext'.$extension;

            if (method_exists($this, $extension)) {
                $this->$extension();
            }
        }
    }
771588
public function getMimeTypeFromExtension($extension) {
        return isset($this->extensionToMimeType[$extension]) ? $this->extensionToMimeType[$extension] : null;
    }
1372462
public static function getExtensionForType($mime_type) {
		static::ensureDataLoaded();

		if (!static::hasType($mime_type)) {
			return;
		}

		$extensions = static::$mime_types[$mime_type];
		if (is_array($extensions)) {
			return $extensions[0];
		}

		return $extensions;
	}
969741
protected function getAdminExtensionReferenceByTypes(array $types)
    {
        $references = [];
        foreach ($types as $type) {
            $references[$type] = new Reference('sonata_translation.admin.extension.'.$type.'_translatable');
        }

        return $references;
    }