Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 * This file is part of the Symfony package.
|
Chris@0
|
5 *
|
Chris@0
|
6 * (c) Fabien Potencier <fabien@symfony.com>
|
Chris@0
|
7 *
|
Chris@0
|
8 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
9 * file that was distributed with this source code.
|
Chris@0
|
10 */
|
Chris@0
|
11
|
Chris@0
|
12 namespace Symfony\Component\HttpKernel;
|
Chris@0
|
13
|
Chris@17
|
14 use Symfony\Component\Config\Loader\LoaderInterface;
|
Chris@0
|
15 use Symfony\Component\DependencyInjection\ContainerInterface;
|
Chris@0
|
16 use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
Chris@0
|
17
|
Chris@0
|
18 /**
|
Chris@0
|
19 * The Kernel is the heart of the Symfony system.
|
Chris@0
|
20 *
|
Chris@0
|
21 * It manages an environment made of bundles.
|
Chris@0
|
22 *
|
Chris@0
|
23 * @author Fabien Potencier <fabien@symfony.com>
|
Chris@0
|
24 */
|
Chris@0
|
25 interface KernelInterface extends HttpKernelInterface, \Serializable
|
Chris@0
|
26 {
|
Chris@0
|
27 /**
|
Chris@0
|
28 * Returns an array of bundles to register.
|
Chris@0
|
29 *
|
Chris@14
|
30 * @return iterable|BundleInterface[] An iterable of bundle instances
|
Chris@0
|
31 */
|
Chris@0
|
32 public function registerBundles();
|
Chris@0
|
33
|
Chris@0
|
34 /**
|
Chris@0
|
35 * Loads the container configuration.
|
Chris@0
|
36 */
|
Chris@0
|
37 public function registerContainerConfiguration(LoaderInterface $loader);
|
Chris@0
|
38
|
Chris@0
|
39 /**
|
Chris@0
|
40 * Boots the current kernel.
|
Chris@0
|
41 */
|
Chris@0
|
42 public function boot();
|
Chris@0
|
43
|
Chris@0
|
44 /**
|
Chris@0
|
45 * Shutdowns the kernel.
|
Chris@0
|
46 *
|
Chris@0
|
47 * This method is mainly useful when doing functional testing.
|
Chris@0
|
48 */
|
Chris@0
|
49 public function shutdown();
|
Chris@0
|
50
|
Chris@0
|
51 /**
|
Chris@0
|
52 * Gets the registered bundle instances.
|
Chris@0
|
53 *
|
Chris@0
|
54 * @return BundleInterface[] An array of registered bundle instances
|
Chris@0
|
55 */
|
Chris@0
|
56 public function getBundles();
|
Chris@0
|
57
|
Chris@0
|
58 /**
|
Chris@0
|
59 * Returns a bundle and optionally its descendants by its name.
|
Chris@0
|
60 *
|
Chris@14
|
61 * The second argument is deprecated as of 3.4 and will be removed in 4.0. This method
|
Chris@14
|
62 * will always return an instance of BundleInterface in 4.0.
|
Chris@14
|
63 *
|
Chris@0
|
64 * @param string $name Bundle name
|
Chris@0
|
65 * @param bool $first Whether to return the first bundle only or together with its descendants
|
Chris@0
|
66 *
|
Chris@0
|
67 * @return BundleInterface|BundleInterface[] A BundleInterface instance or an array of BundleInterface instances if $first is false
|
Chris@0
|
68 *
|
Chris@0
|
69 * @throws \InvalidArgumentException when the bundle is not enabled
|
Chris@0
|
70 */
|
Chris@0
|
71 public function getBundle($name, $first = true);
|
Chris@0
|
72
|
Chris@0
|
73 /**
|
Chris@0
|
74 * Returns the file path for a given resource.
|
Chris@0
|
75 *
|
Chris@0
|
76 * A Resource can be a file or a directory.
|
Chris@0
|
77 *
|
Chris@0
|
78 * The resource name must follow the following pattern:
|
Chris@0
|
79 *
|
Chris@0
|
80 * "@BundleName/path/to/a/file.something"
|
Chris@0
|
81 *
|
Chris@0
|
82 * where BundleName is the name of the bundle
|
Chris@0
|
83 * and the remaining part is the relative path in the bundle.
|
Chris@0
|
84 *
|
Chris@0
|
85 * If $dir is passed, and the first segment of the path is "Resources",
|
Chris@0
|
86 * this method will look for a file named:
|
Chris@0
|
87 *
|
Chris@0
|
88 * $dir/<BundleName>/path/without/Resources
|
Chris@0
|
89 *
|
Chris@0
|
90 * before looking in the bundle resource folder.
|
Chris@0
|
91 *
|
Chris@0
|
92 * @param string $name A resource name to locate
|
Chris@0
|
93 * @param string $dir A directory where to look for the resource first
|
Chris@0
|
94 * @param bool $first Whether to return the first path or paths for all matching bundles
|
Chris@0
|
95 *
|
Chris@0
|
96 * @return string|array The absolute path of the resource or an array if $first is false
|
Chris@0
|
97 *
|
Chris@0
|
98 * @throws \InvalidArgumentException if the file cannot be found or the name is not valid
|
Chris@0
|
99 * @throws \RuntimeException if the name contains invalid/unsafe characters
|
Chris@0
|
100 */
|
Chris@0
|
101 public function locateResource($name, $dir = null, $first = true);
|
Chris@0
|
102
|
Chris@0
|
103 /**
|
Chris@0
|
104 * Gets the name of the kernel.
|
Chris@0
|
105 *
|
Chris@0
|
106 * @return string The kernel name
|
Chris@0
|
107 */
|
Chris@0
|
108 public function getName();
|
Chris@0
|
109
|
Chris@0
|
110 /**
|
Chris@0
|
111 * Gets the environment.
|
Chris@0
|
112 *
|
Chris@0
|
113 * @return string The current environment
|
Chris@0
|
114 */
|
Chris@0
|
115 public function getEnvironment();
|
Chris@0
|
116
|
Chris@0
|
117 /**
|
Chris@0
|
118 * Checks if debug mode is enabled.
|
Chris@0
|
119 *
|
Chris@0
|
120 * @return bool true if debug mode is enabled, false otherwise
|
Chris@0
|
121 */
|
Chris@0
|
122 public function isDebug();
|
Chris@0
|
123
|
Chris@0
|
124 /**
|
Chris@14
|
125 * Gets the application root dir (path of the project's Kernel class).
|
Chris@0
|
126 *
|
Chris@14
|
127 * @return string The Kernel root dir
|
Chris@0
|
128 */
|
Chris@0
|
129 public function getRootDir();
|
Chris@0
|
130
|
Chris@0
|
131 /**
|
Chris@0
|
132 * Gets the current container.
|
Chris@0
|
133 *
|
Chris@17
|
134 * @return ContainerInterface|null A ContainerInterface instance or null when the Kernel is shutdown
|
Chris@0
|
135 */
|
Chris@0
|
136 public function getContainer();
|
Chris@0
|
137
|
Chris@0
|
138 /**
|
Chris@0
|
139 * Gets the request start time (not available if debug is disabled).
|
Chris@0
|
140 *
|
Chris@0
|
141 * @return int The request start timestamp
|
Chris@0
|
142 */
|
Chris@0
|
143 public function getStartTime();
|
Chris@0
|
144
|
Chris@0
|
145 /**
|
Chris@0
|
146 * Gets the cache directory.
|
Chris@0
|
147 *
|
Chris@0
|
148 * @return string The cache directory
|
Chris@0
|
149 */
|
Chris@0
|
150 public function getCacheDir();
|
Chris@0
|
151
|
Chris@0
|
152 /**
|
Chris@0
|
153 * Gets the log directory.
|
Chris@0
|
154 *
|
Chris@0
|
155 * @return string The log directory
|
Chris@0
|
156 */
|
Chris@0
|
157 public function getLogDir();
|
Chris@0
|
158
|
Chris@0
|
159 /**
|
Chris@0
|
160 * Gets the charset of the application.
|
Chris@0
|
161 *
|
Chris@0
|
162 * @return string The charset
|
Chris@0
|
163 */
|
Chris@0
|
164 public function getCharset();
|
Chris@0
|
165 }
|