-
Guillaume Perréal authoredbc58e9ca
<?php
/*
* © 2016 IRSTEA
* Guillaume Perréal <guillaume.perreal@irstea.fr>
* Tous droits réservés.
*/
namespace Irstea\PlantUmlBundle\Model\Decorator;
use Irstea\PlantUmlBundle\Model\ArrowInterface;
use Irstea\PlantUmlBundle\Model\ClassVisitorInterface;
use Irstea\PlantUmlBundle\Model\DecoratorInterface;
use Irstea\PlantUmlBundle\Model\NodeInterface;
/**
* Description of InheritanceDecorator
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
abstract class AbstractRelationDecorator implements DecoratorInterface
{
/**
* @param NodeInterface $source
* @param array $classNames
* @param ClassVisitorInterface $visitor
*/
protected function visitRelations(NodeInterface $source, array $classNames, ClassVisitorInterface $visitor)
{
foreach ($classNames as $className) {
$target = $visitor->visitClass($className);
if ($target) {
$source->addArrow($this->buildRelation($source, $target));
}
}
}
/**
* @param NodeInterface $source
* @param NodeInterface $target
* @return ArrowInterface
*/
abstract protected function buildRelation(NodeInterface $source, NodeInterface $target);
}