* Tous droits réservés. */ namespace Irstea\PlantUmlBundle\Model\Decorator; use Irstea\PlantUmlBundle\Model\ClassFilterInterface; use Irstea\PlantUmlBundle\Model\ClassVisitorInterface; use Irstea\PlantUmlBundle\Model\DecoratorInterface; use Irstea\PlantUmlBundle\Model\NodeInterface; use ReflectionClass; /** * Description of FilteringDecorator * * @author Guillaume Perréal */ class FilteringDecorator implements DecoratorInterface { /** * @var DecoratorInterface */ private $next; /** * @var ClassFilterInterface */ private $filter; /** * @param DecoratorInterface $next * @param ClassFilterInterface $filter */ public function __construct(DecoratorInterface $next, ClassFilterInterface $filter) { $this->next = $next; $this->filter = $filter; } public function decorate(ReflectionClass $class, NodeInterface $node, ClassVisitorInterface $visitor) { if ($this->filter->accept($class)) { $this->next->decorate($class, $node, $visitor); } return $this; } public function toConfig(array &$conf) { $this->filter->toConfig($conf); $this->next->toConfig($conf); } }