An error occurred while loading the file. Please try again.
-
Le Roux Erwan authored07091db8
<?php
/*
* © 2016 IRSTEA
* Guillaume Perréal <guillaume.perreal@irstea.fr>
* Tous droits réservés.
*/
namespace Irstea\PlantUmlBundle\Model\Decorator;
use Irstea\PlantUmlBundle\Model\ClassVisitorInterface;
use Irstea\PlantUmlBundle\Model\DecoratorInterface;
use Irstea\PlantUmlBundle\Model\Node\Member\Member;
use Irstea\PlantUmlBundle\Model\Node\Member\MemberInterface;
use Irstea\PlantUmlBundle\Model\NodeInterface;
use ReflectionClass;
use ReflectionProperty;
/**
* Description of AttributeDecorator
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
class AttributeDecorator implements DecoratorInterface
{
public function decorate(ReflectionClass $class, NodeInterface $node, ClassVisitorInterface $visitor)
{
foreach($class->getProperties() as $property) {
/* @var $property ReflectionProperty */
if ($property->getDeclaringClass() != $class) {
continue;
}
$node->addAttribute(
new Member(
$property->getName(),
false,
$property->isPrivate() ? MemberInterface::PRIVATE_ :
$property->isProtected() ? MemberInterface::PROTECTED_ :
$property->isPublic() ? MemberInterface::PUBLIC_ :
MemberInterface::UNKNOWN
)
);
}
}
}