1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the haveibeenpwned-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2019 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\HaveIBeenPwnedBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
15
|
|
|
use Symfony\Component\Config\FileLocator; |
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
17
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension; |
18
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* HaveIBeenPwned extension. |
22
|
|
|
* |
23
|
|
|
* @author webeweb <https://github.com/webeweb> |
24
|
|
|
* @package WBW\Bundle\HaveIBeenPwnedBundle\DependencyInjection |
25
|
|
|
*/ |
26
|
|
|
class WBWHaveIBeenPwnedExtension extends Extension { |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Extension alias. |
30
|
|
|
* |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
const EXTENSION_ALIAS = "wbw_haveibeenpwned"; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* {@inheritdoc} |
37
|
|
|
*/ |
38
|
|
|
public function getAlias(): string { |
39
|
|
|
return self::EXTENSION_ALIAS; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* {@inheritdoc} |
44
|
|
|
*/ |
45
|
|
|
public function load(array $configs, ContainerBuilder $container): void { |
46
|
|
|
|
47
|
|
|
$fileLocator = new FileLocator(__DIR__ . "/../Resources/config"); |
48
|
|
|
|
49
|
|
|
$serviceLoader = new YamlFileLoader($container, $fileLocator); |
50
|
|
|
$serviceLoader->load("services.yml"); |
51
|
|
|
|
52
|
|
|
/** @var ConfigurationInterface $configuration */ |
53
|
|
|
$configuration = $this->getConfiguration($configs, $container); |
54
|
|
|
|
55
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
56
|
|
|
|
57
|
|
|
if (true === $config["event_listeners"]) { |
58
|
|
|
$serviceLoader->load("event_listeners.yml"); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|