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@0
|
14 use Symfony\Component\DependencyInjection\ContainerInterface;
|
Chris@0
|
15 use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
Chris@0
|
16 use Symfony\Component\Config\Loader\LoaderInterface;
|
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@0
|
30 * @return BundleInterface[] An array 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 * @param LoaderInterface $loader A LoaderInterface instance
|
Chris@0
|
38 */
|
Chris@0
|
39 public function registerContainerConfiguration(LoaderInterface $loader);
|
Chris@0
|
40
|
Chris@0
|
41 /**
|
Chris@0
|
42 * Boots the current kernel.
|
Chris@0
|
43 */
|
Chris@0
|
44 public function boot();
|
Chris@0
|
45
|
Chris@0
|
46 /**
|
Chris@0
|
47 * Shutdowns the kernel.
|
Chris@0
|
48 *
|
Chris@0
|
49 * This method is mainly useful when doing functional testing.
|
Chris@0
|
50 */
|
Chris@0
|
51 public function shutdown();
|
Chris@0
|
52
|
Chris@0
|
53 /**
|
Chris@0
|
54 * Gets the registered bundle instances.
|
Chris@0
|
55 *
|
Chris@0
|
56 * @return BundleInterface[] An array of registered bundle instances
|
Chris@0
|
57 */
|
Chris@0
|
58 public function getBundles();
|
Chris@0
|
59
|
Chris@0
|
60 /**
|
Chris@0
|
61 * Returns a bundle and optionally its descendants by its name.
|
Chris@0
|
62 *
|
Chris@0
|
63 * @param string $name Bundle name
|
Chris@0
|
64 * @param bool $first Whether to return the first bundle only or together with its descendants
|
Chris@0
|
65 *
|
Chris@0
|
66 * @return BundleInterface|BundleInterface[] A BundleInterface instance or an array of BundleInterface instances if $first is false
|
Chris@0
|
67 *
|
Chris@0
|
68 * @throws \InvalidArgumentException when the bundle is not enabled
|
Chris@0
|
69 */
|
Chris@0
|
70 public function getBundle($name, $first = true);
|
Chris@0
|
71
|
Chris@0
|
72 /**
|
Chris@0
|
73 * Returns the file path for a given resource.
|
Chris@0
|
74 *
|
Chris@0
|
75 * A Resource can be a file or a directory.
|
Chris@0
|
76 *
|
Chris@0
|
77 * The resource name must follow the following pattern:
|
Chris@0
|
78 *
|
Chris@0
|
79 * "@BundleName/path/to/a/file.something"
|
Chris@0
|
80 *
|
Chris@0
|
81 * where BundleName is the name of the bundle
|
Chris@0
|
82 * and the remaining part is the relative path in the bundle.
|
Chris@0
|
83 *
|
Chris@0
|
84 * If $dir is passed, and the first segment of the path is "Resources",
|
Chris@0
|
85 * this method will look for a file named:
|
Chris@0
|
86 *
|
Chris@0
|
87 * $dir/<BundleName>/path/without/Resources
|
Chris@0
|
88 *
|
Chris@0
|
89 * before looking in the bundle resource folder.
|
Chris@0
|
90 *
|
Chris@0
|
91 * @param string $name A resource name to locate
|
Chris@0
|
92 * @param string $dir A directory where to look for the resource first
|
Chris@0
|
93 * @param bool $first Whether to return the first path or paths for all matching bundles
|
Chris@0
|
94 *
|
Chris@0
|
95 * @return string|array The absolute path of the resource or an array if $first is false
|
Chris@0
|
96 *
|
Chris@0
|
97 * @throws \InvalidArgumentException if the file cannot be found or the name is not valid
|
Chris@0
|
98 * @throws \RuntimeException if the name contains invalid/unsafe characters
|
Chris@0
|
99 */
|
Chris@0
|
100 public function locateResource($name, $dir = null, $first = true);
|
Chris@0
|
101
|
Chris@0
|
102 /**
|
Chris@0
|
103 * Gets the name of the kernel.
|
Chris@0
|
104 *
|
Chris@0
|
105 * @return string The kernel name
|
Chris@0
|
106 */
|
Chris@0
|
107 public function getName();
|
Chris@0
|
108
|
Chris@0
|
109 /**
|
Chris@0
|
110 * Gets the environment.
|
Chris@0
|
111 *
|
Chris@0
|
112 * @return string The current environment
|
Chris@0
|
113 */
|
Chris@0
|
114 public function getEnvironment();
|
Chris@0
|
115
|
Chris@0
|
116 /**
|
Chris@0
|
117 * Checks if debug mode is enabled.
|
Chris@0
|
118 *
|
Chris@0
|
119 * @return bool true if debug mode is enabled, false otherwise
|
Chris@0
|
120 */
|
Chris@0
|
121 public function isDebug();
|
Chris@0
|
122
|
Chris@0
|
123 /**
|
Chris@0
|
124 * Gets the application root dir.
|
Chris@0
|
125 *
|
Chris@0
|
126 * @return string The application root dir
|
Chris@0
|
127 */
|
Chris@0
|
128 public function getRootDir();
|
Chris@0
|
129
|
Chris@0
|
130 /**
|
Chris@0
|
131 * Gets the current container.
|
Chris@0
|
132 *
|
Chris@0
|
133 * @return ContainerInterface A ContainerInterface instance
|
Chris@0
|
134 */
|
Chris@0
|
135 public function getContainer();
|
Chris@0
|
136
|
Chris@0
|
137 /**
|
Chris@0
|
138 * Gets the request start time (not available if debug is disabled).
|
Chris@0
|
139 *
|
Chris@0
|
140 * @return int The request start timestamp
|
Chris@0
|
141 */
|
Chris@0
|
142 public function getStartTime();
|
Chris@0
|
143
|
Chris@0
|
144 /**
|
Chris@0
|
145 * Gets the cache directory.
|
Chris@0
|
146 *
|
Chris@0
|
147 * @return string The cache directory
|
Chris@0
|
148 */
|
Chris@0
|
149 public function getCacheDir();
|
Chris@0
|
150
|
Chris@0
|
151 /**
|
Chris@0
|
152 * Gets the log directory.
|
Chris@0
|
153 *
|
Chris@0
|
154 * @return string The log directory
|
Chris@0
|
155 */
|
Chris@0
|
156 public function getLogDir();
|
Chris@0
|
157
|
Chris@0
|
158 /**
|
Chris@0
|
159 * Gets the charset of the application.
|
Chris@0
|
160 *
|
Chris@0
|
161 * @return string The charset
|
Chris@0
|
162 */
|
Chris@0
|
163 public function getCharset();
|
Chris@0
|
164 }
|