12use Psr\Log\LoggerInterface;
24 private const CORE_HANDLERS = [
25 'image/jpeg' => JpegHandler::class,
26 'image/png' => PNGHandler::class,
27 'image/gif' => GIFHandler::class,
28 'image/tiff' => TiffHandler::class,
29 'image/webp' => WebPHandler::class,
30 'image/x-ms-bmp' => BmpHandler::class,
31 'image/x-bmp' => BmpHandler::class,
32 'image/x-xcf' => XCFHandler::class,
33 'image/svg+xml' => SvgHandler::class,
34 'image/svg' => SvgHandler::class,
35 'image/vnd.djvu' => DjVuHandler::class,
36 'image/x.djvu' => DjVuHandler::class,
37 'image/x-djvu' => DjVuHandler::class,
38 'image/jp2' => Jpeg2000Handler::class,
39 'image/jpx' => Jpeg2000Handler::class,
56 LoggerInterface $logger,
59 $this->logger = $logger;
60 $this->registry = $registry + self::CORE_HANDLERS;
68 return $this->registry[$type] ??
false;
76 if ( isset( $this->handlers[$type] ) ) {
77 return $this->handlers[$type];
81 if ( $class !==
false ) {
83 $handler =
new $class;
84 if ( !$handler->isEnabled() ) {
86 '{class} is not enabled.',
93 'no handler found for {type}.',
99 $this->handlers[$type] = $handler;
105class_alias( MediaHandlerFactory::class,
'MediaHandlerFactory' );