Commit cb08244c authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

irstea:plantuml:render -vv affiche la configuration utilisée.

parent 2e1b1619
...@@ -66,6 +66,12 @@ class RenderCommand extends ContainerAwareCommand ...@@ -66,6 +66,12 @@ class RenderCommand extends ContainerAwareCommand
{ {
$io->writeln("Fichier de sortie: <comment>$target</comment>"); $io->writeln("Fichier de sortie: <comment>$target</comment>");
if (OutputInterface::VERBOSITY_VERY_VERBOSE <= $io->getVerbosity()) {
$desc = [];
$graph->toConfig($desc);
$io->writeln(json_encode($desc, JSON_PRETTY_PRINT));
}
$io->write("Exploration des classes: "); $io->write("Exploration des classes: ");
$graph->visitAll(); $graph->visitAll();
$io->writeln("<info>Ok</info>."); $io->writeln("<info>Ok</info>.");
......
...@@ -81,4 +81,9 @@ class AssociationDecorator extends AbstractDoctrineDecorator ...@@ -81,4 +81,9 @@ class AssociationDecorator extends AbstractDoctrineDecorator
new BaseArrow($node, $target, "--", $association["fieldName"]." >", $linkSource, $linkTarget, $sourceCardinality, $targetCardinality) new BaseArrow($node, $target, "--", $association["fieldName"]." >", $linkSource, $linkTarget, $sourceCardinality, $targetCardinality)
); );
} }
public function toConfig(array &$conf)
{
$conf['decorators'][] = 'associations';
}
} }
...@@ -15,6 +15,7 @@ namespace Irstea\PlantUmlBundle\Doctrine; ...@@ -15,6 +15,7 @@ namespace Irstea\PlantUmlBundle\Doctrine;
*/ */
class DoctrineNamespace extends \Irstea\PlantUmlBundle\Model\Namespace_\MappedNamespace class DoctrineNamespace extends \Irstea\PlantUmlBundle\Model\Namespace_\MappedNamespace
{ {
const CONF_TYPE = 'entities';
const SEPARATOR = '::'; const SEPARATOR = '::';
public function __construct(\Doctrine\ORM\EntityManagerInterface $em) public function __construct(\Doctrine\ORM\EntityManagerInterface $em)
......
...@@ -34,4 +34,9 @@ class EntityDecorator extends AbstractDoctrineDecorator ...@@ -34,4 +34,9 @@ class EntityDecorator extends AbstractDoctrineDecorator
$class $class
); );
} }
public function toConfig(array &$conf)
{
$conf['decorators'][] = 'entity';
}
} }
...@@ -36,4 +36,9 @@ class EntityFinder implements FinderInterface ...@@ -36,4 +36,9 @@ class EntityFinder implements FinderInterface
} }
return new ArrayIterator($classes); return new ArrayIterator($classes);
} }
public function toConfig(array &$conf)
{
$conf['type'] = 'entities';
}
} }
...@@ -50,4 +50,9 @@ class FieldDecorator extends AbstractDoctrineDecorator ...@@ -50,4 +50,9 @@ class FieldDecorator extends AbstractDoctrineDecorator
$isIdentifier $isIdentifier
)); ));
} }
public function toConfig(array &$conf)
{
$conf['decorators'][] = 'fields';
}
} }
...@@ -74,6 +74,12 @@ class ClassFinder implements FinderInterface ...@@ -74,6 +74,12 @@ class ClassFinder implements FinderInterface
} }
return new ArrayIterator($this->classes); return new ArrayIterator($this->classes);
} }
public function toConfig(array &$conf)
{
$conf['type'] = 'classes';
$conf['directories'] = $this->directories;
}
} }
function irstea_plantmul_include($filepath) function irstea_plantmul_include($filepath)
......
...@@ -38,4 +38,10 @@ class FilteringFinder implements FinderInterface ...@@ -38,4 +38,10 @@ class FilteringFinder implements FinderInterface
{ {
return new CallbackFilterIterator($this->inner->getIterator(), [$this->filter, 'accept']); return new CallbackFilterIterator($this->inner->getIterator(), [$this->filter, 'accept']);
} }
public function toConfig(array &$conf)
{
$this->inner->toConfig($conf);
$this->filter->toConfig($conf);
}
} }
...@@ -8,10 +8,14 @@ ...@@ -8,10 +8,14 @@
namespace Irstea\PlantUmlBundle\Finder; namespace Irstea\PlantUmlBundle\Finder;
use Irstea\PlantUmlBundle\Model\ToConfigInterface;
use IteratorAggregate;
use Traversable;
/** /**
* *
* @author Guillaume Perréal <guillaume.perreal@irstea.fr> * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/ */
interface FinderInterface extends \Traversable, \IteratorAggregate interface FinderInterface extends Traversable, IteratorAggregate, ToConfigInterface
{ {
} }
...@@ -14,7 +14,7 @@ use ReflectionClass; ...@@ -14,7 +14,7 @@ use ReflectionClass;
* *
* @author Guillaume Perréal <guillaume.perreal@irstea.fr> * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/ */
interface ClassFilterInterface interface ClassFilterInterface extends ToConfigInterface
{ {
/** /**
* @param ReflectionClass $class * @param ReflectionClass $class
......
...@@ -123,4 +123,17 @@ class ClassVisitor implements ClassVisitorInterface ...@@ -123,4 +123,17 @@ class ClassVisitor implements ClassVisitorInterface
{ {
return $this->rootNamespace->writeTo($writer); return $this->rootNamespace->writeTo($writer);
} }
/**
* @param array $conf
*/
public function toConfig(array &$conf)
{
$conf['layout'] = [];
$conf['decoration'] = [];
$this->filter->toConfig($conf['layout']);
$this->rootNamespace->toConfig($conf['layout']);
$this->decorator->toConfig($conf['decoration']);
}
} }
...@@ -14,7 +14,7 @@ use Irstea\PlantUmlBundle\Writer\WritableInterface; ...@@ -14,7 +14,7 @@ use Irstea\PlantUmlBundle\Writer\WritableInterface;
* *
* @author Guillaume Perréal <guillaume.perreal@irstea.fr> * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/ */
interface ClassVisitorInterface extends WritableInterface interface ClassVisitorInterface extends WritableInterface, ToConfigInterface
{ {
/** /**
* @param ReflectionClass|string * @param ReflectionClass|string
......
...@@ -44,4 +44,9 @@ class AttributeDecorator implements DecoratorInterface ...@@ -44,4 +44,9 @@ class AttributeDecorator implements DecoratorInterface
); );
} }
} }
public function toConfig(array &$conf)
{
$conf['decorators'][] = 'attributes';
}
} }
...@@ -43,4 +43,11 @@ class CompositeDecorator implements DecoratorInterface ...@@ -43,4 +43,11 @@ class CompositeDecorator implements DecoratorInterface
} }
return $this; return $this;
} }
public function toConfig(array &$conf)
{
foreach($this->decorators as $decorator) {
$decorator->toConfig($conf);
}
}
} }
...@@ -48,4 +48,10 @@ class FilteringDecorator implements DecoratorInterface ...@@ -48,4 +48,10 @@ class FilteringDecorator implements DecoratorInterface
} }
return $this; return $this;
} }
public function toConfig(array &$conf)
{
$this->filter->toConfig($conf);
$this->next->toConfig($conf);
}
} }
...@@ -34,4 +34,9 @@ class InheritanceDecorator extends AbstractRelationDecorator ...@@ -34,4 +34,9 @@ class InheritanceDecorator extends AbstractRelationDecorator
{ {
return new ExtendsClass($source, $target); return new ExtendsClass($source, $target);
} }
public function toConfig(array &$conf)
{
$conf['decorators'][] = 'inheritance';
}
} }
...@@ -51,4 +51,9 @@ class InterfaceDecorator extends AbstractRelationDecorator ...@@ -51,4 +51,9 @@ class InterfaceDecorator extends AbstractRelationDecorator
{ {
return new ImplementsInterface($source, $target); return new ImplementsInterface($source, $target);
} }
public function toConfig(array &$conf)
{
$conf['decorators'][] = 'interfaces';
}
} }
...@@ -68,4 +68,9 @@ class MethodDecorator implements DecoratorInterface ...@@ -68,4 +68,9 @@ class MethodDecorator implements DecoratorInterface
$property = $class->getProperty($name); $property = $class->getProperty($name);
return $property->isStatic() == $method->isStatic(); return $property->isStatic() == $method->isStatic();
} }
public function toConfig(array &$conf)
{
$conf['decorators'][] = 'methods';
}
} }
...@@ -26,4 +26,8 @@ class NullDecorator implements DecoratorInterface ...@@ -26,4 +26,8 @@ class NullDecorator implements DecoratorInterface
{ {
return $this; return $this;
} }
public function toConfig(array &$conf)
{
}
} }
...@@ -39,4 +39,9 @@ class TraitDecorator extends AbstractRelationDecorator ...@@ -39,4 +39,9 @@ class TraitDecorator extends AbstractRelationDecorator
{ {
return new UsesTrait($source, $target); return new UsesTrait($source, $target);
} }
public function toConfig(array &$conf)
{
$conf['decorators'][] = 'traits';
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment