@@ -43,22 +43,39 @@ function kernel_info($name = 'app') {
43
43
function kernel_app($name = 'app') {
44
44
static $kernel;
45
45
$info = kernel_info($name);
46
- if ((!$kernel) && (class_exists($info['kernel class']))) {
47
- if (file_exists($info['autoload'])) {
48
- require_once $info['autoload'];
46
+ if (!$kernel) {
47
+
48
+ if (is_array($info['require_once'])) {
49
+ $files = array_filter($info['require_once'], 'file_exists');
50
+ if (!empty($files)) {
51
+ foreach ($files as $file) {
52
+ require_once $file;
53
+ }
54
+ }
49
55
}
50
- if ($info['debug']) {
56
+
57
+ if ($info['arguments'][1]) {
51
58
\Symfony\Component\Debug\Debug::enable();
52
59
}
53
60
54
- /** @var \Symfony\Component\HttpKernel\KernelInterface $kernel */
55
- $kernel = new $info['kernel class']($info['environment'], $info['debug']);
61
+ if (class_exists($info['kernel class'])) {
62
+
63
+ /* @var \Symfony\Component\HttpKernel\HttpKernelInterface $kernel */
64
+ if (!empty($info['arguments']) && is_array($info['arguments'])) {
65
+ $reflect = new ReflectionClass($info['kernel class']);
66
+ $kernel = $reflect->newInstanceArgs($info['arguments']);
67
+ }
68
+ else {
69
+ $kernel = new $info['kernel class']();
70
+ }
71
+
72
+ foreach ($info['calls'] as $method => $args) {
73
+ call_user_func_array(array($kernel, $method), $args);
74
+ }
56
75
57
- foreach ($info['calls'] as $method => $args) {
58
- call_user_func_array(array($kernel, $method), $args);
76
+ return $kernel;
59
77
}
60
78
}
61
- return $kernel;
62
79
}
63
80
64
81
/**
0 commit comments