public static function registerServiceProvider($serviceProvider)
    {
        if (is_callable($serviceProvider)) {
            $serviceProvider = new CustomServiceProvider($serviceProvider);
        } elseif (!is_a($serviceProvider, ServiceProviderInterface::class, true)) {
            throw new BootstrapException(
                "Error registering service provider: $serviceProvider is not valid service provider."
            );
        }
        if (self::$container === null) {
            self::$serviceProviders[] = $serviceProvider;
        } else {
            /** @var ServiceProviderInterface $provider */
            $provider = new $serviceProvider;
            $provider->register(self::$container);
        }
    }