Avoid levenshtein comparison when using ContainerBuilder.

This commit is contained in:
catch 2014-03-26 14:45:08 +01:00 committed by Fabien Potencier
parent ea4b8bf993
commit cc9cc37e79

View File

@ -461,16 +461,9 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
{ {
$id = strtolower($id); $id = strtolower($id);
if ($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) {
try { return $service;
return parent::get($id, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE);
} catch (InactiveScopeException $e) {
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
return null;
} }
throw $e;
} catch (InvalidArgumentException $e) {
if (isset($this->loading[$id])) { if (isset($this->loading[$id])) {
throw new LogicException(sprintf('The service "%s" has a circular reference to itself.', $id), 0, $e); throw new LogicException(sprintf('The service "%s" has a circular reference to itself.', $id), 0, $e);
} }
@ -507,7 +500,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
return $service; return $service;
} }
}
/** /**
* Merges a ContainerBuilder with the current ContainerBuilder configuration. * Merges a ContainerBuilder with the current ContainerBuilder configuration.