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