Chris@13: name = BuilderHelpers::normalizeName($name); Chris@0: $this->type = $type; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets alias for used name. Chris@0: * Chris@0: * @param string $alias Alias to use (last component of full name by default) Chris@0: * Chris@0: * @return $this The builder instance (for fluid interface) Chris@0: */ Chris@13: public function as(string $alias) { Chris@0: $this->alias = $alias; Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the built node. Chris@0: * Chris@0: * @return Node The built node Chris@0: */ Chris@13: public function getNode() : Node { Chris@13: return new Stmt\Use_([ Chris@13: new Stmt\UseUse($this->name, $this->alias) Chris@13: ], $this->type); Chris@0: } Chris@0: }