1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* Copyright (C) 2020-2025 Iain Cambridge |
7
|
|
|
* |
8
|
|
|
* This program is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by |
10
|
|
|
* the Free Software Foundation, either version 2.1 of the License, or |
11
|
|
|
* (at your option) any later version. |
12
|
|
|
* |
13
|
|
|
* This program is distributed in the hope that it will be useful, |
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
* GNU Lesser General Public License for more details. |
17
|
|
|
* |
18
|
|
|
* You should have received a copy of the GNU General Public License |
19
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Parthenon\DependencyInjection\Modules; |
23
|
|
|
|
24
|
|
|
use Parthenon\Funnel\Repository\FunnelRepositoryInterface; |
25
|
|
|
use Parthenon\Funnel\UnfinnishedActions\ActionInterface; |
26
|
|
|
use Symfony\Component\Config\Definition\Builder\NodeBuilder; |
27
|
|
|
use Symfony\Component\Config\FileLocator; |
28
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
29
|
|
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
30
|
|
|
|
31
|
|
|
final class Funnel implements ModuleConfigurationInterface |
32
|
|
|
{ |
33
|
|
|
public function addConfig(NodeBuilder $nodeBuilder): void |
34
|
|
|
{ |
35
|
|
|
$nodeBuilder |
36
|
|
|
->arrayNode('funnel') |
37
|
|
|
->children() |
38
|
|
|
->booleanNode('enabled')->end() |
39
|
|
|
->end() |
|
|
|
|
40
|
|
|
->end(); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function handleDefaultParameters(ContainerBuilder $container): void |
44
|
|
|
{ |
45
|
|
|
// TODO: Implement handleDefaultParameters() method. |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function handleConfiguration(array $config, ContainerBuilder $container): void |
49
|
|
|
{ |
50
|
|
|
if (!isset($config['funnel']) || !isset($config['funnel']['enabled']) || false == $config['funnel']['enabled']) { |
51
|
|
|
return; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config')); |
55
|
|
|
$loader->load('services/funnel.xml'); |
56
|
|
|
|
57
|
|
|
$container->registerForAutoconfiguration(ActionInterface::class)->addTag('parthenon.funnel.action'); |
58
|
|
|
$container->registerForAutoconfiguration(FunnelRepositoryInterface::class)->addTag('parthenon.funnel.repository'); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|