Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\HttpKernel; Chris@0: Chris@17: use Symfony\Component\Config\Loader\LoaderInterface; Chris@0: use Symfony\Component\DependencyInjection\ContainerInterface; Chris@0: use Symfony\Component\HttpKernel\Bundle\BundleInterface; Chris@0: Chris@0: /** Chris@0: * The Kernel is the heart of the Symfony system. Chris@0: * Chris@0: * It manages an environment made of bundles. Chris@0: * Chris@0: * @author Fabien Potencier Chris@0: */ Chris@0: interface KernelInterface extends HttpKernelInterface, \Serializable Chris@0: { Chris@0: /** Chris@0: * Returns an array of bundles to register. Chris@0: * Chris@14: * @return iterable|BundleInterface[] An iterable of bundle instances Chris@0: */ Chris@0: public function registerBundles(); Chris@0: Chris@0: /** Chris@0: * Loads the container configuration. Chris@0: */ Chris@0: public function registerContainerConfiguration(LoaderInterface $loader); Chris@0: Chris@0: /** Chris@0: * Boots the current kernel. Chris@0: */ Chris@0: public function boot(); Chris@0: Chris@0: /** Chris@0: * Shutdowns the kernel. Chris@0: * Chris@0: * This method is mainly useful when doing functional testing. Chris@0: */ Chris@0: public function shutdown(); Chris@0: Chris@0: /** Chris@0: * Gets the registered bundle instances. Chris@0: * Chris@0: * @return BundleInterface[] An array of registered bundle instances Chris@0: */ Chris@0: public function getBundles(); Chris@0: Chris@0: /** Chris@0: * Returns a bundle and optionally its descendants by its name. Chris@0: * Chris@14: * The second argument is deprecated as of 3.4 and will be removed in 4.0. This method Chris@14: * will always return an instance of BundleInterface in 4.0. Chris@14: * Chris@0: * @param string $name Bundle name Chris@0: * @param bool $first Whether to return the first bundle only or together with its descendants Chris@0: * Chris@0: * @return BundleInterface|BundleInterface[] A BundleInterface instance or an array of BundleInterface instances if $first is false Chris@0: * Chris@0: * @throws \InvalidArgumentException when the bundle is not enabled Chris@0: */ Chris@0: public function getBundle($name, $first = true); Chris@0: Chris@0: /** Chris@0: * Returns the file path for a given resource. Chris@0: * Chris@0: * A Resource can be a file or a directory. Chris@0: * Chris@0: * The resource name must follow the following pattern: Chris@0: * Chris@0: * "@BundleName/path/to/a/file.something" Chris@0: * Chris@0: * where BundleName is the name of the bundle Chris@0: * and the remaining part is the relative path in the bundle. Chris@0: * Chris@0: * If $dir is passed, and the first segment of the path is "Resources", Chris@0: * this method will look for a file named: Chris@0: * Chris@0: * $dir//path/without/Resources Chris@0: * Chris@0: * before looking in the bundle resource folder. Chris@0: * Chris@0: * @param string $name A resource name to locate Chris@0: * @param string $dir A directory where to look for the resource first Chris@0: * @param bool $first Whether to return the first path or paths for all matching bundles Chris@0: * Chris@0: * @return string|array The absolute path of the resource or an array if $first is false Chris@0: * Chris@0: * @throws \InvalidArgumentException if the file cannot be found or the name is not valid Chris@0: * @throws \RuntimeException if the name contains invalid/unsafe characters Chris@0: */ Chris@0: public function locateResource($name, $dir = null, $first = true); Chris@0: Chris@0: /** Chris@0: * Gets the name of the kernel. Chris@0: * Chris@0: * @return string The kernel name Chris@0: */ Chris@0: public function getName(); Chris@0: Chris@0: /** Chris@0: * Gets the environment. Chris@0: * Chris@0: * @return string The current environment Chris@0: */ Chris@0: public function getEnvironment(); Chris@0: Chris@0: /** Chris@0: * Checks if debug mode is enabled. Chris@0: * Chris@0: * @return bool true if debug mode is enabled, false otherwise Chris@0: */ Chris@0: public function isDebug(); Chris@0: Chris@0: /** Chris@14: * Gets the application root dir (path of the project's Kernel class). Chris@0: * Chris@14: * @return string The Kernel root dir Chris@0: */ Chris@0: public function getRootDir(); Chris@0: Chris@0: /** Chris@0: * Gets the current container. Chris@0: * Chris@17: * @return ContainerInterface|null A ContainerInterface instance or null when the Kernel is shutdown Chris@0: */ Chris@0: public function getContainer(); Chris@0: Chris@0: /** Chris@0: * Gets the request start time (not available if debug is disabled). Chris@0: * Chris@0: * @return int The request start timestamp Chris@0: */ Chris@0: public function getStartTime(); Chris@0: Chris@0: /** Chris@0: * Gets the cache directory. Chris@0: * Chris@0: * @return string The cache directory Chris@0: */ Chris@0: public function getCacheDir(); Chris@0: Chris@0: /** Chris@0: * Gets the log directory. Chris@0: * Chris@0: * @return string The log directory Chris@0: */ Chris@0: public function getLogDir(); Chris@0: Chris@0: /** Chris@0: * Gets the charset of the application. Chris@0: * Chris@0: * @return string The charset Chris@0: */ Chris@0: public function getCharset(); Chris@0: }