* Tous droits réservés. */ namespace Irstea\PlantUmlBundle\Model\Namespace_\Php; use Irstea\PlantUmlBundle\Model\ArrowInterface; use Irstea\PlantUmlBundle\Model\NamespaceInterface; use Irstea\PlantUmlBundle\Writer\WriterInterface; /** * Description of Namespace * * @author Guillaume Perréal */ class Namespace_ extends AbstractHierachicalNamespace { /** * @var AbstractNamespace */ private $parent; /** * @var string */ private $name; public function __construct(AbstractHierachicalNamespace $parent, $name) { $this->parent = $parent; $this->name = $name; } /** * @param ArrowInterface $arrow * @return self */ public function addArrow(ArrowInterface $arrow) { $this->parent->addArrow($arrow); return $this; } /** * @return string */ protected function getNamespacePrefix() { return $this->parent->getNamespacePrefix() . $this->name . '\\'; } /** * @param resource WriterInterface $writer * @return self */ public function outputTo(WriterInterface $writer) { if ($this->isEmpty()) { return; } $writer ->printf("namespace %s {\n", $this->name) ->indent(); $this ->outputNodesTo($writer) ->outputChildrenTo($writer); $writer ->dedent() ->write("}\n"); return $this; } }