. */ namespace Irstea\PlantUmlBundle\Model; use Irstea\PlantUmlBundle\Finder\FinderInterface; use Irstea\PlantUmlBundle\Writer\WriterInterface; /** * Description of Graph. */ class Graph implements GraphInterface { /** * @var ClassVisitorInterface */ private $visitor; /** * @var FinderInterface */ private $finder; /** * Graph constructor. * @param ClassVisitorInterface $visitor * @param FinderInterface $finder */ public function __construct(ClassVisitorInterface $visitor, FinderInterface $finder) { $this->visitor = $visitor; $this->finder = $finder; } /** * */ public function visitAll(): void { foreach ($this->finder->getIterator() as $class) { $this->visitor->visitClass($class); } } /** * @param WriterInterface $writer * @return $this */ public function writeTo(WriterInterface $writer): self { $writer->write("@startuml@\n"); $this->visitor->writeTo($writer); $writer->write("@enduml@\n"); return $this; } /** * @param array $conf */ public function toConfig(array &$conf) { $conf['sources'] = []; $this->finder->toConfig($conf['sources']); $this->visitor->toConfig($conf); } }