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

Par défaut, utilise le filtre de sélection des entrées pour la décoration.

No related merge requests found
Showing with 8 additions and 6 deletions
+8 -6
...@@ -106,13 +106,15 @@ class GenerateCommand extends ContainerAwareCommand ...@@ -106,13 +106,15 @@ class GenerateCommand extends ContainerAwareCommand
$config = $graphs[$name]; $config = $graphs[$name];
list($finder, $filter) = $this->buildFinder($config['sources']);
$graph = new Graph( $graph = new Graph(
new ClassVisitor( new ClassVisitor(
$this->buildDecorator($config['decoration']), $this->buildDecorator($config['decoration'], $filter),
$this->buildFilter($config['layout']), $this->buildFilter($config['layout']),
$this->buildNamespace($config['layout']['namespaces']) $this->buildNamespace($config['layout']['namespaces'])
), ),
$this->buildFinder($config['sources']) $finder
); );
$graph->visitAll(); $graph->visitAll();
...@@ -138,10 +140,10 @@ class GenerateCommand extends ContainerAwareCommand ...@@ -138,10 +140,10 @@ class GenerateCommand extends ContainerAwareCommand
$filter = $this->buildFilter($config); $filter = $this->buildFilter($config);
if (!$filter) { if (!$filter) {
return $finder; return [$finder, null];
} }
return new FilteringFinder($finder, $filter); return [new FilteringFinder($finder, $filter), $filter];
} }
/** /**
...@@ -169,7 +171,7 @@ class GenerateCommand extends ContainerAwareCommand ...@@ -169,7 +171,7 @@ class GenerateCommand extends ContainerAwareCommand
* @return DecoratorInterface * @return DecoratorInterface
* @throws RuntimeException * @throws RuntimeException
*/ */
protected function buildDecorator(array $config) protected function buildDecorator(array $config, ClassFilterInterface $defaultFilter = null)
{ {
if (empty($config['decorators'])) { if (empty($config['decorators'])) {
return NullDecorator::instance(); return NullDecorator::instance();
...@@ -186,7 +188,7 @@ class GenerateCommand extends ContainerAwareCommand ...@@ -186,7 +188,7 @@ class GenerateCommand extends ContainerAwareCommand
$decorator = new CompositeDecorator($decorators); $decorator = new CompositeDecorator($decorators);
} }
$filter = $this->buildFilter($config); $filter = $this->buildFilter($config) ?: $defaultFilter;
if ($filter) { if ($filter) {
$decorator = new FilteringDecorator($decorator, $filter); $decorator = new FilteringDecorator($decorator, $filter);
} }
......
Supports Markdown
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