public getNamespace ( string $name ) : PDepend\Source\AST\ASTNamespace | ||
$name | string | |
리턴 | PDepend\Source\AST\ASTNamespace |
public function getNamespace($name)
{
if ($this->namespaces === null) {
$msg = 'getNamespace() doesn\'t work before the source was analyzed.';
throw new \RuntimeException($msg);
}
foreach ($this->namespaces as $namespace) {
if ($namespace->getName() === $name) {
return $namespace;
}
}
throw new \OutOfBoundsException(sprintf('Unknown namespace "%s".', $name));
}