RootNamespace.php 1.23 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_\Php;
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 AbstractNamespace
20
{
21
22
    const CONF_TYPE = 'php';

23
    /**
24
     * @var ArrowInterface[]
25
26
27
     */
    private $arrows = [];

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

34
    public function writeTo(WriterInterface $writer)
35
    {
36
        $writer->write("set namespaceSeparator .\n");
37
        $this
38
39
40
            ->writeNodesTo($writer)
            ->writeChildrenTo($writer)
            ->writeArrowsTo($writer);
41
42
43
        return $this;
    }

44
    protected function writeArrowsTo(WriterInterface $writer)
45
46
    {
        foreach ($this->arrows as $arrow) {
47
            $arrow->writeTo($writer);
48
49
50
        }
        return $this;
    }
51
52
53
54
55

    protected function getNamespacePrefix()
    {
        return "";
    }
56
57
58
59
60

    public function getNodeLabel($className)
    {
        return $className;
    }
61
}