/
KernelExtension.php
106 lines (94 loc) · 3.33 KB
/
KernelExtension.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
namespace Symfony\Foundation\Bundle;
/*
* This file is part of the symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Components\DependencyInjection\Loader\LoaderExtension;
use Symfony\Components\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Components\DependencyInjection\BuilderConfiguration;
/**
*
* @package Symfony
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
*/
class KernelExtension extends LoaderExtension
{
public function configLoad($config)
{
$configuration = new BuilderConfiguration();
$loader = new XmlFileLoader(array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config'));
$configuration->merge($loader->load('services.xml'));
if (isset($config['charset']))
{
$configuration->setParameter('kernel.charset', $config['charset']);
}
if (!array_key_exists('compilation', $config))
{
$classes = array(
'Symfony\\Components\\Routing\\Router',
'Symfony\\Components\\Routing\\RouterInterface',
'Symfony\\Components\\EventDispatcher\\Event',
'Symfony\\Components\\Routing\\Matcher\\UrlMatcherInterface',
'Symfony\\Components\\Routing\\Matcher\\UrlMatcher',
'Symfony\\Components\\RequestHandler\\RequestInterface',
'Symfony\\Components\\RequestHandler\\Request',
'Symfony\\Components\\RequestHandler\\RequestHandler',
'Symfony\\Components\\RequestHandler\\ResponseInterface',
'Symfony\\Components\\RequestHandler\\Response',
'Symfony\\Components\\Templating\\Loader\\LoaderInterface',
'Symfony\\Components\\Templating\\Loader\\Loader',
'Symfony\\Components\\Templating\\Loader\\FilesystemLoader',
'Symfony\\Components\\Templating\\Engine',
'Symfony\\Components\\Templating\\Renderer\\RendererInterface',
'Symfony\\Components\\Templating\\Renderer\\Renderer',
'Symfony\\Components\\Templating\\Renderer\\PhpRenderer',
'Symfony\\Components\\Templating\\Storage\\Storage',
'Symfony\\Components\\Templating\\Storage\\FileStorage',
'Symfony\\Framework\\WebBundle\\Controller',
'Symfony\\Framework\\WebBundle\\Listener\\RequestParser',
'Symfony\\Framework\\WebBundle\\Listener\\ControllerLoader',
'Symfony\\Framework\\WebBundle\\Listener\\ResponseFilter',
'Symfony\\Framework\\WebBundle\\Templating\\Engine',
);
}
else
{
$classes = array();
foreach (explode("\n", $config['compilation']) as $class)
{
if ($class)
{
$classes[] = trim($class);
}
}
}
$configuration->setParameter('kernel.compiled_classes', $classes);
if (array_key_exists('error_handler_level', $config))
{
$configuration->setParameter('error_handler.level', $config['error_handler_level']);
}
return $configuration;
}
/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
*/
public function getXsdValidationBasePath()
{
return false;
}
public function getNamespace()
{
return 'http://www.symfony-project.org/schema/dic/symfony/kernel';
}
public function getAlias()
{
return 'kernel';
}
}