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
...@@ -14,7 +14,12 @@ use ReflectionClass; ...@@ -14,7 +14,12 @@ use ReflectionClass;
* *
* @author Guillaume Perréal <guillaume.perreal@irstea.fr> * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/ */
interface DecoratorInterface interface DecoratorInterface extends ToConfigInterface
{ {
/**
* @param ReflectionClass $class
* @param NodeInterface $node
* @param ClassVisitorInterface $visitor
*/
public function decorate(ReflectionClass $class, NodeInterface $node, ClassVisitorInterface $visitor); public function decorate(ReflectionClass $class, NodeInterface $node, ClassVisitorInterface $visitor);
} }
...@@ -45,6 +45,15 @@ abstract class AbstractListFilter implements ClassFilterInterface ...@@ -45,6 +45,15 @@ abstract class AbstractListFilter implements ClassFilterInterface
return $this->notFound; return $this->notFound;
} }
public function toConfig(array &$conf)
{
$key = $this->notFound ? 'exclude' : 'include';
if (!array_key_exists($key, $conf)) {
$conf[$key] = [];
}
$conf[$key][static::CONF_TYPE] = $this->allowed;
}
/** /**
* @param string $value * @param string $value
* @return string * @return string
......
...@@ -24,4 +24,8 @@ class AcceptAllFilter implements ClassFilterInterface ...@@ -24,4 +24,8 @@ class AcceptAllFilter implements ClassFilterInterface
{ {
return true; return true;
} }
public function toConfig(array &$conf)
{
}
} }
...@@ -17,6 +17,8 @@ use ReflectionClass; ...@@ -17,6 +17,8 @@ use ReflectionClass;
*/ */
class ClassFilter extends AbstractListFilter class ClassFilter extends AbstractListFilter
{ {
const CONF_TYPE = 'classes';
protected function extract(ReflectionClass $class) protected function extract(ReflectionClass $class)
{ {
return $class->getName(); return $class->getName();
......
...@@ -27,4 +27,11 @@ abstract class AbstractCompositeFilter implements ClassFilterInterface ...@@ -27,4 +27,11 @@ abstract class AbstractCompositeFilter implements ClassFilterInterface
{ {
$this->filters = $filters; $this->filters = $filters;
} }
public function toConfig(array &$conf)
{
foreach($this->filters as $filter) {
$filter->toConfig($conf);
}
}
} }
...@@ -17,6 +17,8 @@ use ReflectionClass; ...@@ -17,6 +17,8 @@ use ReflectionClass;
*/ */
class DirectoryFilter extends AbstractListFilter class DirectoryFilter extends AbstractListFilter
{ {
const CONF_TYPE = 'directories';
protected function extract(ReflectionClass $class) protected function extract(ReflectionClass $class)
{ {
return dirname($class->getFileName()); return dirname($class->getFileName());
......
...@@ -17,6 +17,8 @@ use ReflectionClass; ...@@ -17,6 +17,8 @@ use ReflectionClass;
*/ */
class NamespaceFilter extends AbstractListFilter class NamespaceFilter extends AbstractListFilter
{ {
const CONF_TYPE = 'namespaces';
protected function extract(ReflectionClass $class) protected function extract(ReflectionClass $class)
{ {
return $class->getNamespaceName(); return $class->getNamespaceName();
......
...@@ -48,4 +48,14 @@ class Graph implements GraphInterface ...@@ -48,4 +48,14 @@ class Graph implements GraphInterface
$writer->write("@enduml@\n"); $writer->write("@enduml@\n");
return $this; return $this;
} }
/**
* @param array $conf
*/
public function toConfig(array &$conf)
{
$conf['sources'] = [];
$this->finder->toConfig($conf['sources']);
$this->visitor->toConfig($conf);
}
} }
...@@ -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 GraphInterface extends WritableInterface interface GraphInterface extends WritableInterface, ToConfigInterface
{ {
/** /**
* @return void * @return void
......
...@@ -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 NamespaceInterface extends WritableInterface interface NamespaceInterface extends WritableInterface, ToConfigInterface
{ {
/** /**
* @param string $namespaceName * @param string $namespaceName
......
...@@ -54,4 +54,9 @@ abstract class AbstractNamespace implements WritableInterface, NamespaceInterfac ...@@ -54,4 +54,9 @@ abstract class AbstractNamespace implements WritableInterface, NamespaceInterfac
{ {
return empty($this->nodes); return empty($this->nodes);
} }
public function toConfig(array &$conf)
{
$conf['namespace'] = static::CONF_TYPE;
}
} }
...@@ -15,6 +15,7 @@ namespace Irstea\PlantUmlBundle\Model\Namespace_; ...@@ -15,6 +15,7 @@ namespace Irstea\PlantUmlBundle\Model\Namespace_;
*/ */
class BundleNamespace extends MappedNamespace class BundleNamespace extends MappedNamespace
{ {
const CONF_TYPE = 'bundles';
const SEPARATOR = '::'; const SEPARATOR = '::';
public function __construct(array $bundles) public function __construct(array $bundles)
......
...@@ -18,6 +18,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface; ...@@ -18,6 +18,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
*/ */
class FlatNamespace extends AbstractNamespace class FlatNamespace extends AbstractNamespace
{ {
const CONF_TYPE = 'flat';
const SEPARATOR = 'none'; const SEPARATOR = 'none';
/** /**
......
...@@ -18,6 +18,8 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface; ...@@ -18,6 +18,8 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
*/ */
class RootNamespace extends AbstractNamespace class RootNamespace extends AbstractNamespace
{ {
const CONF_TYPE = 'php';
/** /**
* @var ArrowInterface[] * @var ArrowInterface[]
*/ */
......
<?php
/*
* © 2016 IRSTEA
* Guillaume Perréal <guillaume.perreal@irstea.fr>
* Tous droits réservés.
*/
namespace Irstea\PlantUmlBundle\Model;
/**
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
interface ToConfigInterface
{
/**
* @param array $conf
*/
public function toConfig(array &$conf);
}
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