<?php

declare(strict_types=1);

namespace RainbowDrive\Support;

final class LegacyAutoload
{
    public function __construct(
        private string $projectRoot
    ) {
    }

    public function register(): void
    {
        $rootVendorAutoload = $this->projectRoot . '/vendor/autoload.php';
        if (is_file($rootVendorAutoload)) {
            require_once $rootVendorAutoload;
        }

        $legacyVendorAutoload = $this->projectRoot . '/includes/vendor/autoload.php';
        if (is_file($legacyVendorAutoload)) {
            require_once $legacyVendorAutoload;
        }
    }
}
