public function getProvider($name, $tag = null)
{
if ($this->hasProvider($name, $tag)) {
return $this->providers[$this->hashProviderName($name, $tag)];
}
try {
// Tags are not supported for lazy-loaded providers because every instance would be the same.
if ($tag === null) {
$this->registerProvider($provider = $this->getOrCreateProviderFactory()->createProvider("{$name}"));
return $provider;
}
} catch (ObjectNotCreatedException $exception) {
// Intentionally empty.
}
throw new ProviderNotFoundException("No such provider registered: \"{$name}\" with tag \"{$tag}\".", isset($exception) ? $exception : null);
}