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,
72 LoggerInterface $logger,
75 $this->logger = $logger;
76 $this->registry = $registry + self::CORE_HANDLERS;
80 return $this->registry[$type] ??
false;
88 if ( isset( $this->handlers[$type] ) ) {
89 return $this->handlers[$type];
93 if ( $class !==
false ) {
95 $handler =
new $class;
96 if ( !$handler->isEnabled() ) {
98 '{class} is not enabled.',
104 $this->logger->debug(
105 'no handler found for {type}.',
111 $this->handlers[$type] = $handler;