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);
        }
    }
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);
        }
    }
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 ) ; } }
Registers service provider.

This method can be used before or after service container initialization.

@param string|callable $serviceProvider service provider class or callable
Registers service provider .