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