3 namespace PhpParser\Builder;
7 use PhpParser\Node\Stmt;
9 class Namespace_ extends Declaration
12 private $stmts = array();
15 * Creates a namespace builder.
17 * @param Node\Name|string|null $name Name of the namespace
19 public function __construct($name) {
20 $this->name = null !== $name ? $this->normalizeName($name) : null;
26 * @param Node|PhpParser\Builder $stmt The statement to add
28 * @return $this The builder instance (for fluid interface)
30 public function addStmt($stmt) {
31 $this->stmts[] = $this->normalizeNode($stmt);
37 * Returns the built node.
39 * @return Node The built node
41 public function getNode() {
42 return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes);