[DependencyInjection] added some missing accessors

This commit is contained in:
Fabien Potencier 2010-01-14 18:22:29 +01:00
parent 1a0bcd141a
commit 7e2d6c0043
1 changed files with 31 additions and 0 deletions

View File

@ -157,6 +157,37 @@ class BuilderConfiguration
return $this->aliases;
}
/**
* Returns true if a service alias exists.
*
* @param string $alias The alias
*
* @return Boolean true if the alias exists, false otherwise
*/
public function hasAlias($alias)
{
return array_key_exists($alias, $this->aliases);
}
/**
* Gets the service id for a given alias.
*
* @param string $alias The alias
*
* @return string The aliased id
*
* @throws \InvalidArgumentException if the service alias does not exist
*/
public function getAlias($alias)
{
if (!$this->hasAlias($alias))
{
throw new \InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $alias));
}
return $this->aliases[$alias];
}
/**
* Sets a definition.
*