-
Guillaume Perréal authoredd56eec09
<?php declare(strict_types=1);
/*
* Copyright (C) 2016-2018 IRSTEA
* All rights reserved.
*/
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;
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 writeTo(WriterInterface $writer)
{
$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);
}
}