Sin descripción

KernelInterface.php 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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\Config\Loader\LoaderInterface;
  12. use Symfony\Component\DependencyInjection\ContainerInterface;
  13. use Symfony\Component\HttpKernel\Bundle\BundleInterface;
  14. /**
  15. * The Kernel is the heart of the Symfony system.
  16. *
  17. * It manages an environment made of application kernel and bundles.
  18. *
  19. * @author Fabien Potencier <fabien@symfony.com>
  20. *
  21. * @method string getProjectDir() Gets the project dir (path of the project's composer file) - not defining it is deprecated since Symfony 4.2
  22. */
  23. interface KernelInterface extends HttpKernelInterface
  24. {
  25. /**
  26. * Returns an array of bundles to register.
  27. *
  28. * @return iterable|BundleInterface[] An iterable of bundle instances
  29. */
  30. public function registerBundles();
  31. /**
  32. * Loads the container configuration.
  33. */
  34. public function registerContainerConfiguration(LoaderInterface $loader);
  35. /**
  36. * Boots the current kernel.
  37. */
  38. public function boot();
  39. /**
  40. * Shutdowns the kernel.
  41. *
  42. * This method is mainly useful when doing functional testing.
  43. */
  44. public function shutdown();
  45. /**
  46. * Gets the registered bundle instances.
  47. *
  48. * @return BundleInterface[] An array of registered bundle instances
  49. */
  50. public function getBundles();
  51. /**
  52. * Returns a bundle.
  53. *
  54. * @param string $name Bundle name
  55. *
  56. * @return BundleInterface A BundleInterface instance
  57. *
  58. * @throws \InvalidArgumentException when the bundle is not enabled
  59. */
  60. public function getBundle($name);
  61. /**
  62. * Returns the file path for a given bundle resource.
  63. *
  64. * A Resource can be a file or a directory.
  65. *
  66. * The resource name must follow the following pattern:
  67. *
  68. * "@BundleName/path/to/a/file.something"
  69. *
  70. * where BundleName is the name of the bundle
  71. * and the remaining part is the relative path in the bundle.
  72. *
  73. * @param string $name A resource name to locate
  74. *
  75. * @return string|array The absolute path of the resource or an array if $first is false (array return value is deprecated)
  76. *
  77. * @throws \InvalidArgumentException if the file cannot be found or the name is not valid
  78. * @throws \RuntimeException if the name contains invalid/unsafe characters
  79. */
  80. public function locateResource($name/*, $dir = null, $first = true*/);
  81. /**
  82. * Gets the name of the kernel.
  83. *
  84. * @return string The kernel name
  85. *
  86. * @deprecated since Symfony 4.2
  87. */
  88. public function getName();
  89. /**
  90. * Gets the environment.
  91. *
  92. * @return string The current environment
  93. */
  94. public function getEnvironment();
  95. /**
  96. * Checks if debug mode is enabled.
  97. *
  98. * @return bool true if debug mode is enabled, false otherwise
  99. */
  100. public function isDebug();
  101. /**
  102. * Gets the application root dir (path of the project's Kernel class).
  103. *
  104. * @return string The Kernel root dir
  105. *
  106. * @deprecated since Symfony 4.2
  107. */
  108. public function getRootDir();
  109. /**
  110. * Gets the current container.
  111. *
  112. * @return ContainerInterface
  113. */
  114. public function getContainer();
  115. /**
  116. * Gets the request start time (not available if debug is disabled).
  117. *
  118. * @return float The request start timestamp
  119. */
  120. public function getStartTime();
  121. /**
  122. * Gets the cache directory.
  123. *
  124. * @return string The cache directory
  125. */
  126. public function getCacheDir();
  127. /**
  128. * Gets the log directory.
  129. *
  130. * @return string The log directory
  131. */
  132. public function getLogDir();
  133. /**
  134. * Gets the charset of the application.
  135. *
  136. * @return string The charset
  137. */
  138. public function getCharset();
  139. }