| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the Symfony package.
|
|
|
5 |
*
|
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.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\Config\Loader\LoaderInterface;
|
|
|
15 |
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
|
16 |
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
|
|
17 |
|
|
|
18 |
/**
|
|
|
19 |
* The Kernel is the heart of the Symfony system.
|
|
|
20 |
*
|
|
|
21 |
* It manages an environment made of application kernel and bundles.
|
|
|
22 |
*
|
|
|
23 |
* @author Fabien Potencier <fabien@symfony.com>
|
|
|
24 |
*/
|
|
|
25 |
interface KernelInterface extends HttpKernelInterface
|
|
|
26 |
{
|
|
|
27 |
/**
|
|
|
28 |
* Returns an array of bundles to register.
|
|
|
29 |
*
|
|
|
30 |
* @return iterable<mixed, BundleInterface>
|
|
|
31 |
*/
|
|
|
32 |
public function registerBundles(): iterable;
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* Loads the container configuration.
|
|
|
36 |
*/
|
|
|
37 |
public function registerContainerConfiguration(LoaderInterface $loader);
|
|
|
38 |
|
|
|
39 |
/**
|
|
|
40 |
* Boots the current kernel.
|
|
|
41 |
*/
|
|
|
42 |
public function boot();
|
|
|
43 |
|
|
|
44 |
/**
|
|
|
45 |
* Shutdowns the kernel.
|
|
|
46 |
*
|
|
|
47 |
* This method is mainly useful when doing functional testing.
|
|
|
48 |
*/
|
|
|
49 |
public function shutdown();
|
|
|
50 |
|
|
|
51 |
/**
|
|
|
52 |
* Gets the registered bundle instances.
|
|
|
53 |
*
|
|
|
54 |
* @return array<string, BundleInterface>
|
|
|
55 |
*/
|
|
|
56 |
public function getBundles(): array;
|
|
|
57 |
|
|
|
58 |
/**
|
|
|
59 |
* Returns a bundle.
|
|
|
60 |
*
|
|
|
61 |
* @throws \InvalidArgumentException when the bundle is not enabled
|
|
|
62 |
*/
|
|
|
63 |
public function getBundle(string $name): BundleInterface;
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
* Returns the file path for a given bundle resource.
|
|
|
67 |
*
|
|
|
68 |
* A Resource can be a file or a directory.
|
|
|
69 |
*
|
|
|
70 |
* The resource name must follow the following pattern:
|
|
|
71 |
*
|
|
|
72 |
* "@BundleName/path/to/a/file.something"
|
|
|
73 |
*
|
|
|
74 |
* where BundleName is the name of the bundle
|
|
|
75 |
* and the remaining part is the relative path in the bundle.
|
|
|
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(string $name): string;
|
|
|
81 |
|
|
|
82 |
/**
|
|
|
83 |
* Gets the environment.
|
|
|
84 |
*/
|
|
|
85 |
public function getEnvironment(): string;
|
|
|
86 |
|
|
|
87 |
/**
|
|
|
88 |
* Checks if debug mode is enabled.
|
|
|
89 |
*/
|
|
|
90 |
public function isDebug(): bool;
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* Gets the project dir (path of the project's composer file).
|
|
|
94 |
*/
|
|
|
95 |
public function getProjectDir(): string;
|
|
|
96 |
|
|
|
97 |
/**
|
|
|
98 |
* Gets the current container.
|
|
|
99 |
*/
|
|
|
100 |
public function getContainer(): ContainerInterface;
|
|
|
101 |
|
|
|
102 |
/**
|
|
|
103 |
* Gets the request start time (not available if debug is disabled).
|
|
|
104 |
*/
|
|
|
105 |
public function getStartTime(): float;
|
|
|
106 |
|
|
|
107 |
/**
|
|
|
108 |
* Gets the cache directory.
|
|
|
109 |
*
|
|
|
110 |
* Since Symfony 5.2, the cache directory should be used for caches that are written at runtime.
|
|
|
111 |
* For caches and artifacts that can be warmed at compile-time and deployed as read-only,
|
|
|
112 |
* use the new "build directory" returned by the {@see getBuildDir()} method.
|
|
|
113 |
*/
|
|
|
114 |
public function getCacheDir(): string;
|
|
|
115 |
|
|
|
116 |
/**
|
|
|
117 |
* Returns the build directory.
|
|
|
118 |
*
|
|
|
119 |
* This directory should be used to store build artifacts, and can be read-only at runtime.
|
|
|
120 |
* Caches written at runtime should be stored in the "cache directory" ({@see KernelInterface::getCacheDir()}).
|
|
|
121 |
*/
|
|
|
122 |
public function getBuildDir(): string;
|
|
|
123 |
|
|
|
124 |
/**
|
|
|
125 |
* Gets the log directory.
|
|
|
126 |
*/
|
|
|
127 |
public function getLogDir(): string;
|
|
|
128 |
|
|
|
129 |
/**
|
|
|
130 |
* Gets the charset of the application.
|
|
|
131 |
*/
|
|
|
132 |
public function getCharset(): string;
|
|
|
133 |
}
|