public function registerProvider($provider)
{
if ($this->getProvider($provider) !== null) {
throw new ResourceOccupiedException("ServiceProvider " . $this->getProviderClass($provider) . " already registered.");
}
if (is_string($provider) && ($class = $provider) && ($provider = $this->resolveProviderClass($provider)) === null) {
throw new InvalidArgumentException("ServiceProvider {$class} is not valid provider.");
}
$ex = null;
try {
if ($this->booted) {
$provider->registerProvider($this->container);
}
} catch (Error $ex) {
} catch (Exception $ex) {
}
if ($ex !== null) {
throw new ExecutionException("ServiceProvider " . $this->getProviderClass($provider) . " failed during registration.", $ex);
}
$this->markProviderRegistered($provider);
}