InheritanceDecorator.php 1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
<?php

/*
 * © 2016 IRSTEA
 * Guillaume Perréal <guillaume.perreal@irstea.fr>
 * Tous droits réservés.
 */

namespace Irstea\PlantUmlBundle\Model\Decorator;

11
use Irstea\PlantUmlBundle\Model\Arrow\ExtendsClass;
12
13
14
15
16
17
18
19
20
21
22
use Irstea\PlantUmlBundle\Model\ClassVisitor;
use Irstea\PlantUmlBundle\Model\ClassVisitorInterface;
use Irstea\PlantUmlBundle\Model\DecoratorInterface;
use Irstea\PlantUmlBundle\Model\NodeInterface;
use ReflectionClass;

/**
 * Description of InheritanceDecorator
 *
 * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
 */
23
class InheritanceDecorator extends AbstractRelationDecorator
24
{
25
    public function decorate(ReflectionClass $class, NodeInterface $node, ClassVisitorInterface $visitor)
26
27
28
    {
        $parent = $class->getParentClass();
        if ($parent) {
29
            $this->visitRelations($node, [$parent->getName()], $visitor);
30
31
32
        }
    }

33
    protected function buildRelation(NodeInterface $source, NodeInterface $target)
34
    {
35
        return new ExtendsClass($source, $target);
36
37
    }
}