* Tous droits réservés. */ namespace Irstea\PlantUmlBundle\Model\Node; use Irstea\PlantUmlBundle\Model\UmlNodeInterface; /** * Description of Class * * @author Guillaume Perréal */ class BaseNode implements UmlNodeInterface { /** * @var string */ private $name; /** * @var string */ private $nodeType; /** * @var string[] */ private $classifiers; /** * @var string[] */ private $stereotypes; /** * @param string $name * @param string $nodeType * @param array $classifiers * @param array $stereotypes */ function __construct($name, $nodeType, array $classifiers = [], array $stereotypes = []) { $this->name = $name; $this->nodeType = $nodeType; $this->classifiers = $classifiers; $this->stereotypes = $stereotypes; } public function outputTo($stream) { $this->outputClassifiersTo($stream); $this->outputNodeTypeTo($stream); $this->outputAliasTo($stream); $this->outputStereotypesTo($stream); fputs($stream, " {\n"); $this->outputAttributesTo($stream); $this->outputMethodsTo($stream); fputs($stream, "}\n"); } public function outputAliasTo($stream) { fputs($stream, '"'.str_replace('\\', '\\\\', $this->name).'"'); } protected function outputClassifiersTo($stream) { foreach($this->classifiers as $classifier) { fputs($stream, "$classifier "); } } protected function outputNodeTypeTo($stream) { fputs($stream, $this->nodeType." "); } protected function outputStereotypesTo($stream) { foreach($this->stereotypes as $stereotypes) { fputs($stream, " <<$stereotypes>>"); } } protected function outputAttributesTo($stream) { // NOP } protected function outputMethodsTo($stream) { // NOP } }