<?php /* * © 2016 IRSTEA * Guillaume Perréal <guillaume.perreal@irstea.fr> * Tous droits réservés. */ namespace Irstea\PlantUmlBundle\Model; use Irstea\PlantUmlBundle\Finder\FinderInterface; use Irstea\PlantUmlBundle\Writer\WriterInterface; /** * Description of Graph * * @author Guillaume Perréal <guillaume.perreal@irstea.fr> */ class Graph implements GraphInterface { /** * @var ClassVisitorInterface */ private $visitor; /** * @var FinderInterface */ private $finder; public function __construct(ClassVisitorInterface $visitor, FinderInterface $finder) { $this->visitor = $visitor; $this->finder = $finder; } public function visitAll() { foreach($this->finder->getIterator() as $class) { $this->visitor->visitClass($class); } } public function outputTo(WriterInterface $writer) { $writer->write("@startuml@\n"); $this->visitor->outputTo($writer); $writer->write("@enduml@\n"); return $this; } }