-
Raidelet Nicolas authored7b889ef8
<?php declare(strict_types=1);
/*
* Copyright (C) 2016-2017 IRSTEA
* All rights reserved.
*/
namespace Irstea\PlantUmlBundle\Model\Decorator;
use Irstea\PlantUmlBundle\Model\Arrow\ExtendsClass;
use Irstea\PlantUmlBundle\Model\ClassVisitorInterface;
use Irstea\PlantUmlBundle\Model\NodeInterface;
use ReflectionClass;
/**
* Description of InheritanceDecorator.
*/
class InheritanceDecorator extends AbstractRelationDecorator
{
public function decorate(ReflectionClass $class, NodeInterface $node, ClassVisitorInterface $visitor)
{
$parent = $class->getParentClass();
if ($parent) {
$this->visitRelations($node, [$parent->getName()], $visitor);
}
}
protected function buildRelation(NodeInterface $source, NodeInterface $target)
{
return new ExtendsClass($source, $target);
}
public function toConfig(array &$conf)
{
$conf['decorators'][] = 'inheritance';
}
}