1 | <?php |
||
12 | class JnsXhprofExtension extends Extension |
||
13 | { |
||
14 | /** |
||
15 | * Xml config files to load |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $resources = array( |
||
19 | 'services' => 'services.xml', |
||
20 | ); |
||
21 | |||
22 | /** |
||
23 | * Loads the services based on your application configuration. |
||
24 | * |
||
25 | * @param array $configs |
||
26 | * @param ContainerBuilder $container |
||
27 | */ |
||
28 | public function load(array $configs, ContainerBuilder $container) |
||
29 | { |
||
30 | $processor = new Processor(); |
||
31 | $configuration = new Configuration(); |
||
32 | $config = $processor->process($configuration->getConfigTreeBuilder()->buildTree(), $configs); |
||
33 | |||
34 | if ($config['enabled']) { |
||
35 | if (!$config['require_extension_exists'] || function_exists('xhprof_enable')) { |
||
36 | $this->loadDefaults($container); |
||
37 | |||
38 | foreach ($config as $key => $value) { |
||
39 | $container->setParameter($this->getAlias().'.'.$key, $value); |
||
40 | } |
||
41 | } else { |
||
42 | throw new InvalidConfigurationException("Xhprof Bundle is enabled but the xhprof extension is not enabled."); |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 | |||
47 | public function getAlias() |
||
51 | |||
52 | /** |
||
53 | * Get File Loader |
||
54 | * |
||
55 | * @param ContainerBuilder $container |
||
56 | * |
||
57 | * @return XmlFileLoader |
||
58 | */ |
||
59 | public function getFileLoader($container) |
||
63 | |||
64 | /** |
||
65 | * @param ContainerBuilder $container |
||
66 | */ |
||
67 | protected function loadDefaults($container) |
||
75 | } |
||
76 |