AbstractNamespace.php 1.17 KiB
<?php declare(strict_types=1);
/*
 * Copyright (C) 2016-2017 IRSTEA
 * All rights reserved.
 */
namespace Irstea\PlantUmlBundle\Model\Namespace_;
use Irstea\PlantUmlBundle\Model\NamespaceInterface;
use Irstea\PlantUmlBundle\Model\NodeInterface;
use Irstea\PlantUmlBundle\Writer\WritableInterface;
use Irstea\PlantUmlBundle\Writer\WriterInterface;
/**
 * Description of Namespace.
abstract class AbstractNamespace implements WritableInterface, NamespaceInterface
    /**
     * @var NodeInterface[]
    private $nodes = [];
    /**
     * @param NodeInterface $node
    public function addNode(NodeInterface $node)
        $this->nodes[] = $node;
        return $this;
    /**
     * @param WriterInterface $writer
     * @return self
    protected function writeNodesTo(WriterInterface $writer)
        foreach ($this->nodes as $node) {
            $node->writeTo($writer);
        return $this;
    /**
     * @return bool
    protected function isEmpty()
        return empty($this->nodes);
    public function toConfig(array &$conf)
        $conf['namespace'] = static::CONF_TYPE;