From 760a9d2454e725e7b56050ebdd0eb251e2cb8650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Thu, 6 Jan 2022 11:31:02 +0100 Subject: [PATCH] feat: allow skipping some routes when generating the site (#21) --- src/Bridge/Symfony/DependencyInjection/Configuration.php | 3 +++ src/Permutator.php | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/Bridge/Symfony/DependencyInjection/Configuration.php b/src/Bridge/Symfony/DependencyInjection/Configuration.php index 588980d..714b9f7 100644 --- a/src/Bridge/Symfony/DependencyInjection/Configuration.php +++ b/src/Bridge/Symfony/DependencyInjection/Configuration.php @@ -31,6 +31,9 @@ public function getConfigTreeBuilder(): TreeBuilder ->isRequired() ->cannotBeEmpty() ->end() + ->booleanNode('skip') + ->defaultFalse() + ->end() ->variableNode('defaults') ->end() ->variableNode('catalog') diff --git a/src/Permutator.php b/src/Permutator.php index 3c31848..30912e8 100644 --- a/src/Permutator.php +++ b/src/Permutator.php @@ -29,6 +29,10 @@ public function __construct(array $routes, Database $database) public function permute(): iterable { foreach ($this->routes as $route => $spec) { + if ($spec['skip']) { + continue; + } + $variables = []; if ( ! isset($spec['catalog'])) { yield $route => $spec['defaults'] ?? [];