An error occurred while loading the file. Please try again.
-
Guillaume Perréal authored3bdfbc13
<?php
/*
* © 2016 IRSTEA
* Guillaume Perréal <guillaume.perreal@irstea.fr>
* Tous droits réservés.
*/
namespace Irstea\PlantUmlBundle\Model\Namespace_;
use Irstea\PlantUmlBundle\Model\ArrowInterface;
use Irstea\PlantUmlBundle\Model\NamespaceInterface;
use Irstea\PlantUmlBundle\Writer\WriterInterface;
/**
* Description of Namespace
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
class Namespace_ extends AbstractNamespace
{
/**
* @var NamespaceInterface
*/
private $parent;
/**
* @var string
*/
private $name;
public function __construct(NamespaceInterface $parent, $name)
{
$this->parent = $parent;
$this->name = $name;
}
/**
* @param ArrowInterface $arrow
* @return self
*/
public function addArrow(ArrowInterface $arrow)
{
$this->parent->addArrow($arrow);
return $this;
}
/**
* @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;
}
}
71