FlatNamespace.php 1.31 KiB
<?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\Writer\WriterInterface;
/**
 * Description of RootNamespace
 * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
class FlatNamespace extends AbstractNamespace
    const SEPARATOR = 'none';
    /**
     * @var ArrowInterface[]
    private $arrows = [];
    public function addArrow(ArrowInterface $arrow)
        $this->arrows[] = $arrow;
        return $this;
    public function writeTo(WriterInterface $writer)
        $writer->writeFormatted("set namespaceSeparator %s\n", static::SEPARATOR);
        $this
            ->writeNodesTo($writer)
            ->writeArrowsTo($writer);
        return $this;
    protected function writeArrowsTo(WriterInterface $writer)
        foreach ($this->arrows as $arrow) {
            $arrow->writeTo($writer);
        return $this;
    public function getNamespace($namespaceName)
        return $this;
    public function getNodeId($name)
        return str_replace('\\', '_', $name);
    public function getNodeLabel($name)
        return $name;