24use Psr\Log\LoggerInterface;
36 private const CORE_HANDLERS = [
37 'image/jpeg' => JpegHandler::class,
38 'image/png' => PNGHandler::class,
39 'image/gif' => GIFHandler::class,
40 'image/tiff' => TiffHandler::class,
41 'image/webp' => WebPHandler::class,
42 'image/x-ms-bmp' => BmpHandler::class,
43 'image/x-bmp' => BmpHandler::class,
44 'image/x-xcf' => XCFHandler::class,
45 'image/svg+xml' => SvgHandler::class,
46 'image/svg' => SvgHandler::class,
47 'image/vnd.djvu' => DjVuHandler::class,
48 'image/x.djvu' => DjVuHandler::class,
49 'image/x-djvu' => DjVuHandler::class,
50 'image/jp2' => Jpeg2000Handler::class,
51 'image/jpx' => Jpeg2000Handler::class,
68 LoggerInterface $logger,
71 $this->logger = $logger;
72 $this->registry = $registry + self::CORE_HANDLERS;
76 return $this->registry[$type] ??
false;
84 if ( isset( $this->handlers[$type] ) ) {
85 return $this->handlers[$type];
89 if ( $class !==
false ) {
91 $handler =
new $class;
92 if ( !$handler->isEnabled() ) {
94 '{class} is not enabled.',
100 $this->logger->debug(
101 'no handler found for {type}.',
107 $this->handlers[$type] = $handler;