<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Bootstrap;

final class PlatformBootstrap
{
    private static ?PlatformClassLoader $loader = null;

    public static function boot(string $basePath, bool $useCache = true): PlatformClassLoader
    {
        if (!self::$loader instanceof PlatformClassLoader) {
            self::$loader = PlatformClassLoader::register($basePath, $useCache);
        }

        return self::$loader;
    }

    public static function loader(): ?PlatformClassLoader
    {
        return self::$loader;
    }

    public static function reset(): void
    {
        self::$loader = null;
    }
}
