/
SentryExtension.php
38 lines (33 loc) · 1.27 KB
/
SentryExtension.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace Sentry\SentryBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class SentryExtension extends Extension
{
/**
* {@inheritDoc}
*
* @throws InvalidConfigurationException
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
foreach ($config as $key => $value) {
$container->setParameter('sentry.' . $key, $value);
}
foreach ($config['listener_priorities'] as $key => $priority) {
$container->setParameter('sentry.listener_priorities.' . $key, $priority);
}
}
}