| 1: | <?php declare(strict_types=1); |
| 2: | |
| 3: | namespace PhpParser\Builder; |
| 4: | |
| 5: | use PhpParser; |
| 6: | use PhpParser\BuilderHelpers; |
| 7: | use PhpParser\Node; |
| 8: | use PhpParser\Node\Stmt; |
| 9: | |
| 10: | class Namespace_ extends Declaration |
| 11: | { |
| 12: | private $name; |
| 13: | private $stmts = []; |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | public function __construct($name) { |
| 21: | $this->name = null !== $name ? BuilderHelpers::normalizeName($name) : null; |
| 22: | } |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | public function addStmt($stmt) { |
| 32: | $this->stmts[] = BuilderHelpers::normalizeStmt($stmt); |
| 33: | |
| 34: | return $this; |
| 35: | } |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | |
| 42: | public function getNode() : Node { |
| 43: | return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes); |
| 44: | } |
| 45: | } |
| 46: | |