10use Psr\Log\LoggerInterface;
22 private const CORE_HANDLERS = [
23 'image/jpeg' => JpegHandler::class,
24 'image/png' => PNGHandler::class,
25 'image/gif' => GIFHandler::class,
26 'image/tiff' => TiffHandler::class,
27 'image/webp' => WebPHandler::class,
28 'image/x-ms-bmp' => BmpHandler::class,
29 'image/x-bmp' => BmpHandler::class,
30 'image/x-xcf' => XCFHandler::class,
31 'image/svg+xml' => SvgHandler::class,
32 'image/svg' => SvgHandler::class,
33 'image/vnd.djvu' => DjVuHandler::class,
34 'image/x.djvu' => DjVuHandler::class,
35 'image/x-djvu' => DjVuHandler::class,
36 'image/jp2' => Jpeg2000Handler::class,
37 'image/jpx' => Jpeg2000Handler::class,
54 LoggerInterface $logger,
57 $this->logger = $logger;
58 $this->registry = $registry + self::CORE_HANDLERS;
66 return $this->registry[$type] ??
false;
74 if ( isset( $this->handlers[$type] ) ) {
75 return $this->handlers[$type];
79 if ( $class !==
false ) {
81 $handler =
new $class;
82 if ( !$handler->isEnabled() ) {
84 '{class} is not enabled.',
91 'no handler found for {type}.',
97 $this->handlers[$type] = $handler;