<?php
spl_autoload_register(function (string $class): void {
    $map = [
        'PHPMailer\\PHPMailer\\Exception' => __DIR__ . '/Compat/PHPMailerException.php',
        'PHPMailer\\PHPMailer\\PHPMailer' => __DIR__ . '/Compat/PHPMailer.php',
        'Mpdf\\Mpdf' => __DIR__ . '/Compat/Mpdf.php',
        'Mpdf\\Output\\Destination' => __DIR__ . '/Compat/MpdfDestination.php',
        'Endroid\\QrCode\\QrCode' => __DIR__ . '/Compat/QrCode.php',
        'Endroid\\QrCode\\Writer\\PngWriter' => __DIR__ . '/Compat/PngWriter.php',
    ];

    if (isset($map[$class]) && !class_exists($class, false) && !interface_exists($class, false)) {
        require_once $map[$class];
    }
});
