|
0
|
1 |
<?php |
|
|
2 |
|
|
|
3 |
/* |
|
|
4 |
* This file is part of the Symfony package. |
|
|
5 |
* |
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com> |
|
|
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 Symfony\Component\HttpKernel; |
|
|
13 |
|
|
|
14 |
use Symfony\Component\DependencyInjection\ContainerInterface; |
|
|
15 |
use Symfony\Component\HttpKernel\HttpKernelInterface; |
|
|
16 |
use Symfony\Component\HttpKernel\Bundle\BundleInterface; |
|
|
17 |
use Symfony\Component\Config\Loader\LoaderInterface; |
|
|
18 |
|
|
|
19 |
/** |
|
|
20 |
* The Kernel is the heart of the Symfony system. |
|
|
21 |
* |
|
|
22 |
* It manages an environment made of bundles. |
|
|
23 |
* |
|
|
24 |
* @author Fabien Potencier <fabien@symfony.com> |
|
|
25 |
* |
|
|
26 |
* @api |
|
|
27 |
*/ |
|
|
28 |
interface KernelInterface extends HttpKernelInterface, \Serializable |
|
|
29 |
{ |
|
|
30 |
/** |
|
|
31 |
* Returns an array of bundles to registers. |
|
|
32 |
* |
|
|
33 |
* @return array An array of bundle instances. |
|
|
34 |
* |
|
|
35 |
* @api |
|
|
36 |
*/ |
|
|
37 |
function registerBundles(); |
|
|
38 |
|
|
|
39 |
/** |
|
|
40 |
* Loads the container configuration |
|
|
41 |
* |
|
|
42 |
* @param LoaderInterface $loader A LoaderInterface instance |
|
|
43 |
* |
|
|
44 |
* @api |
|
|
45 |
*/ |
|
|
46 |
function registerContainerConfiguration(LoaderInterface $loader); |
|
|
47 |
|
|
|
48 |
/** |
|
|
49 |
* Boots the current kernel. |
|
|
50 |
* |
|
|
51 |
* @api |
|
|
52 |
*/ |
|
|
53 |
function boot(); |
|
|
54 |
|
|
|
55 |
/** |
|
|
56 |
* Shutdowns the kernel. |
|
|
57 |
* |
|
|
58 |
* This method is mainly useful when doing functional testing. |
|
|
59 |
* |
|
|
60 |
* @api |
|
|
61 |
*/ |
|
|
62 |
function shutdown(); |
|
|
63 |
|
|
|
64 |
/** |
|
|
65 |
* Gets the registered bundle instances. |
|
|
66 |
* |
|
|
67 |
* @return array An array of registered bundle instances |
|
|
68 |
* |
|
|
69 |
* @api |
|
|
70 |
*/ |
|
|
71 |
function getBundles(); |
|
|
72 |
|
|
|
73 |
/** |
|
|
74 |
* Checks if a given class name belongs to an active bundle. |
|
|
75 |
* |
|
|
76 |
* @param string $class A class name |
|
|
77 |
* |
|
|
78 |
* @return Boolean true if the class belongs to an active bundle, false otherwise |
|
|
79 |
* |
|
|
80 |
* @api |
|
|
81 |
*/ |
|
|
82 |
function isClassInActiveBundle($class); |
|
|
83 |
|
|
|
84 |
/** |
|
|
85 |
* Returns a bundle and optionally its descendants by its name. |
|
|
86 |
* |
|
|
87 |
* @param string $name Bundle name |
|
|
88 |
* @param Boolean $first Whether to return the first bundle only or together with its descendants |
|
|
89 |
* |
|
|
90 |
* @return BundleInterface|Array A BundleInterface instance or an array of BundleInterface instances if $first is false |
|
|
91 |
* |
|
|
92 |
* @throws \InvalidArgumentException when the bundle is not enabled |
|
|
93 |
* |
|
|
94 |
* @api |
|
|
95 |
*/ |
|
|
96 |
function getBundle($name, $first = true); |
|
|
97 |
|
|
|
98 |
/** |
|
|
99 |
* Returns the file path for a given resource. |
|
|
100 |
* |
|
|
101 |
* A Resource can be a file or a directory. |
|
|
102 |
* |
|
|
103 |
* The resource name must follow the following pattern: |
|
|
104 |
* |
|
|
105 |
* @BundleName/path/to/a/file.something |
|
|
106 |
* |
|
|
107 |
* where BundleName is the name of the bundle |
|
|
108 |
* and the remaining part is the relative path in the bundle. |
|
|
109 |
* |
|
|
110 |
* If $dir is passed, and the first segment of the path is Resources, |
|
|
111 |
* this method will look for a file named: |
|
|
112 |
* |
|
|
113 |
* $dir/BundleName/path/without/Resources |
|
|
114 |
* |
|
|
115 |
* @param string $name A resource name to locate |
|
|
116 |
* @param string $dir A directory where to look for the resource first |
|
|
117 |
* @param Boolean $first Whether to return the first path or paths for all matching bundles |
|
|
118 |
* |
|
|
119 |
* @return string|array The absolute path of the resource or an array if $first is false |
|
|
120 |
* |
|
|
121 |
* @throws \InvalidArgumentException if the file cannot be found or the name is not valid |
|
|
122 |
* @throws \RuntimeException if the name contains invalid/unsafe characters |
|
|
123 |
* |
|
|
124 |
* @api |
|
|
125 |
*/ |
|
|
126 |
function locateResource($name, $dir = null, $first = true); |
|
|
127 |
|
|
|
128 |
/** |
|
|
129 |
* Gets the name of the kernel |
|
|
130 |
* |
|
|
131 |
* @return string The kernel name |
|
|
132 |
* |
|
|
133 |
* @api |
|
|
134 |
*/ |
|
|
135 |
function getName(); |
|
|
136 |
|
|
|
137 |
/** |
|
|
138 |
* Gets the environment. |
|
|
139 |
* |
|
|
140 |
* @return string The current environment |
|
|
141 |
* |
|
|
142 |
* @api |
|
|
143 |
*/ |
|
|
144 |
function getEnvironment(); |
|
|
145 |
|
|
|
146 |
/** |
|
|
147 |
* Checks if debug mode is enabled. |
|
|
148 |
* |
|
|
149 |
* @return Boolean true if debug mode is enabled, false otherwise |
|
|
150 |
* |
|
|
151 |
* @api |
|
|
152 |
*/ |
|
|
153 |
function isDebug(); |
|
|
154 |
|
|
|
155 |
/** |
|
|
156 |
* Gets the application root dir. |
|
|
157 |
* |
|
|
158 |
* @return string The application root dir |
|
|
159 |
* |
|
|
160 |
* @api |
|
|
161 |
*/ |
|
|
162 |
function getRootDir(); |
|
|
163 |
|
|
|
164 |
/** |
|
|
165 |
* Gets the current container. |
|
|
166 |
* |
|
|
167 |
* @return ContainerInterface A ContainerInterface instance |
|
|
168 |
* |
|
|
169 |
* @api |
|
|
170 |
*/ |
|
|
171 |
function getContainer(); |
|
|
172 |
|
|
|
173 |
/** |
|
|
174 |
* Gets the request start time (not available if debug is disabled). |
|
|
175 |
* |
|
|
176 |
* @return integer The request start timestamp |
|
|
177 |
* |
|
|
178 |
* @api |
|
|
179 |
*/ |
|
|
180 |
function getStartTime(); |
|
|
181 |
|
|
|
182 |
/** |
|
|
183 |
* Gets the cache directory. |
|
|
184 |
* |
|
|
185 |
* @return string The cache directory |
|
|
186 |
* |
|
|
187 |
* @api |
|
|
188 |
*/ |
|
|
189 |
function getCacheDir(); |
|
|
190 |
|
|
|
191 |
/** |
|
|
192 |
* Gets the log directory. |
|
|
193 |
* |
|
|
194 |
* @return string The log directory |
|
|
195 |
* |
|
|
196 |
* @api |
|
|
197 |
*/ |
|
|
198 |
function getLogDir(); |
|
|
199 |
} |