No Description

KernelInterface.php 5.1KB

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