Chris@0: name = $this->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@0: protected function as_($alias) { Chris@0: $this->alias = $alias; Chris@0: return $this; Chris@0: } Chris@0: public function __call($name, $args) { Chris@0: if (method_exists($this, $name . '_')) { Chris@0: return call_user_func_array(array($this, $name . '_'), $args); Chris@0: } Chris@0: Chris@0: throw new \LogicException(sprintf('Method "%s" does not exist', $name)); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the built node. Chris@0: * Chris@0: * @return Node The built node Chris@0: */ Chris@0: public function getNode() { Chris@0: $alias = null !== $this->alias ? $this->alias : $this->name->getLast(); Chris@0: return new Stmt\Use_(array( Chris@0: new Stmt\UseUse($this->name, $alias) Chris@0: ), $this->type); Chris@0: } Chris@0: }