An error occurred while loading the file. Please try again.
-
Dumoulin Nicolas authored28bf25f2
<?php
/*
* © 2016 IRSTEA
* Guillaume Perréal <guillaume.perreal@irstea.fr>
* Tous droits réservés.
*/
namespace Irstea\PlantUmlBundle\Model\Arrow;
use Irstea\PlantUmlBundle\Model\ArrowInterface;
use Irstea\PlantUmlBundle\Model\NodeInterface;
use Irstea\PlantUmlBundle\Writer\WriterInterface;
/**
* Description of Arrow
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
class BaseArrow implements ArrowInterface
{
/**
* @var NodeInterface
*/
private $source;
/**
* @var NodeInterface
*/
private $target;
/**
* @var string
*/
private $link;
public function __construct(NodeInterface $source, NodeInterface $target, $link = "--", $label = null)
{
$this->source = $source;
$this->target = $target;
$this->link = $link;
$this->label = $label;
}
public function writeTo(WriterInterface $writer)
{
$this->source->writeAliasTo($writer);
$this->writeLinkTo($writer);
$this->target->writeAliasTo($writer);
$this->writeLabelTo($writer);
$writer->write("\n");
return $this;
}
protected function writeLabelTo(WriterInterface $writer)
{
if ($this->label) {
$writer->writeFormatted(" : %s", $this->label);
}
return $this;
}
protected function writeLinkTo(WriterInterface $writer)
{
$writer->writeFormatted(" %s ", $this->link);
return $this;
}
}