Skip to content

Commit

Permalink
Container: optimized getService() performance
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik authored and dg committed Feb 5, 2015
1 parent 9ae99c7 commit 25c332c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/DI/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ public function removeService($name)
*/
public function getService($name)
{
$name = isset($this->meta[self::ALIASES][$name]) ? $this->meta[self::ALIASES][$name] : $name;
if (!isset($this->registry[$name])) {
if (isset($this->meta[self::ALIASES][$name])) {
return $this->getService($this->meta[self::ALIASES][$name]);
}
$this->registry[$name] = $this->createService($name);
}
return $this->registry[$name];
Expand Down

0 comments on commit 25c332c

Please sign in to comment.