* Tous droits réservés. */ namespace Irstea\PlantUmlBundle\Model\Decorator; use Irstea\PlantUmlBundle\Model\Arrow\UsesTrait; use Irstea\PlantUmlBundle\Model\ClassVisitorInterface; use Irstea\PlantUmlBundle\Model\DecoratorInterface; use Irstea\PlantUmlBundle\Model\NodeInterface; use ReflectionClass; /** * Description of InheritanceDecorator * * @author Guillaume Perréal */ class TraitDecorator extends AbstractRelationDecorator { public function decorate(ReflectionClass $class, NodeInterface $node, ClassVisitorInterface $visitor) { $traits = $class->getTraitNames(); $parent = $class->getParentClass(); if ($parent) { $traits = array_diff($traits, $parent->getTraitNames()); } $this->visitRelations($node, $traits, $visitor); return $this; } protected function buildRelation(NodeInterface $source, NodeInterface $target) { return new UsesTrait($source, $target); } }