RootNamespace.php 1.13 KB
Newer Older
1
2
3
4
5
6
7
8
<?php

/*
 * © 2016 IRSTEA
 * Guillaume Perréal <guillaume.perreal@irstea.fr>
 * Tous droits réservés.
 */

9
namespace Irstea\PlantUmlBundle\Model\Namespace_;
10

11
use Irstea\PlantUmlBundle\Model\ArrowInterface;
12
13
use Irstea\PlantUmlBundle\Writer\WriterInterface;

14
15
16
17
18
/**
 * Description of RootNamespace
 *
 * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
 */
19
class RootNamespace extends AbstractHierachicalNamespace
20
21
{
    /**
22
     * @var ArrowInterface[]
23
24
25
     */
    private $arrows = [];

26
    public function addArrow(ArrowInterface $arrow)
27
28
29
30
31
    {
        $this->arrows[] = $arrow;
        return $this;
    }

32
    public function outputTo(WriterInterface $writer)
33
    {
34
        $writer->write("set namespaceSeparator .\n");
35
36
37
38
39
40
41
        $this
            ->outputNodesTo($writer)
            ->outputChildrenTo($writer)
            ->outputArrowsTo($writer);
        return $this;
    }

42
    protected function outputArrowsTo(WriterInterface $writer)
43
44
45
46
47
48
    {
        foreach ($this->arrows as $arrow) {
            $arrow->outputTo($writer);
        }
        return $this;
    }
49
50
51
52
53

    protected function getNamespacePrefix()
    {
        return "";
    }
54
}