abstract class Kernel implements KernelInterface, TerminableInterface
The Kernel is the heart of the Symfony system.
It manages an environment made of bundles.
Constants
| VERSION |
|
| VERSION_ID |
|
| MAJOR_VERSION |
|
| MINOR_VERSION |
|
| RELEASE_VERSION |
|
| EXTRA_VERSION |
|
Methods
|
__construct(string $environment, Boolean $debug)
Constructor. |
||
|
init()
|
||
|
__clone()
|
||
|
boot()
Boots the current kernel. |
||
|
terminate(Request $request, Response $response)
Terminates a request/response cycle. |
||
|
shutdown()
Shutdowns the kernel. |
||
| Response |
handle(Request $request, integer $type = HttpKernelInterface::MASTER_REQUEST, Boolean $catch = true)
Handles a Request to convert it to a Response. |
|
| BundleInterface[] |
getBundles()
Gets the registered bundle instances. |
|
| Boolean |
isClassInActiveBundle(string $class)
Checks if a given class name belongs to an active bundle. |
|
| BundleInterface|BundleInterface[] |
getBundle(string $name, Boolean $first = true)
Returns a bundle and optionally its descendants by its name. |
|
| string|array |
locateResource(string $name, string $dir = null, Boolean $first = true)
Returns the file path for a given resource. |
|
| string |
getName()
Gets the name of the kernel |
|
| string |
getEnvironment()
Gets the environment. |
|
| Boolean |
isDebug()
Checks if debug mode is enabled. |
|
| string |
getRootDir()
Gets the application root dir. |
|
| ContainerInterface |
getContainer()
Gets the current container. |
|
|
loadClassCache(string $name = 'classes', string $extension = '.php')
Loads the PHP class cache. |
||
|
setClassCache(array $classes)
Used internally. |
||
| integer |
getStartTime()
Gets the request start time (not available if debug is disabled). |
|
| string |
getCacheDir()
Gets the cache directory. |
|
| string |
getLogDir()
Gets the log directory. |
|
| string |
getCharset()
Gets the charset of the application. |
|
| static string |
stripComments(string $source)
Removes comments from a PHP source string. |
|
|
serialize()
|
||
|
unserialize($data)
|
Details
at line 79
public
__construct(string $environment, Boolean $debug)
Constructor.
at line 99
public
init()
at line 103
public
__clone()
at line 118
public
boot()
Boots the current kernel.
at line 147
public
terminate(Request $request, Response $response)
Terminates a request/response cycle.
Should be called after sending the response and before shutting down the kernel.
at line 163
public
shutdown()
Shutdowns the kernel.
This method is mainly useful when doing functional testing.
at line 184
public Response
handle(Request $request, integer $type = HttpKernelInterface::MASTER_REQUEST, Boolean $catch = true)
Handles a Request to convert it to a Response.
When $catch is true, the implementation must catch all exceptions and do its best to convert them to a Response instance.
at line 208
public BundleInterface[]
getBundles()
Gets the registered bundle instances.
at line 218
public Boolean
isClassInActiveBundle(string $class)
Checks if a given class name belongs to an active bundle.
at line 234
public BundleInterface|BundleInterface[]
getBundle(string $name, Boolean $first = true)
Returns a bundle and optionally its descendants by its name.
at line 278
public string|array
locateResource(string $name, string $dir = null, Boolean $first = true)
Returns the file path for a given resource.
A Resource can be a file or a directory.
The resource name must follow the following pattern:
at line 337
public string
getName()
Gets the name of the kernel
at line 351
public string
getEnvironment()
Gets the environment.
at line 361
public Boolean
isDebug()
Checks if debug mode is enabled.
at line 371
public string
getRootDir()
Gets the application root dir.
at line 386
public ContainerInterface
getContainer()
Gets the current container.
at line 403
public
loadClassCache(string $name = 'classes', string $extension = '.php')
Loads the PHP class cache.
This methods only registers the fact that you want to load the cache classes. The cache will actually only be loaded when the Kernel is booted.
That optimization is mainly useful when using the HttpCache class in which case the class cache is not loaded if the Response is in the cache.
at line 411
public
setClassCache(array $classes)
Used internally.
at line 421
public integer
getStartTime()
Gets the request start time (not available if debug is disabled).
at line 431
public string
getCacheDir()
Gets the cache directory.
at line 441
public string
getLogDir()
Gets the log directory.
at line 451
public string
getCharset()
Gets the charset of the application.
at line 754
static public string
stripComments(string $source)
Removes comments from a PHP source string.
We don't use the PHP phpstripwhitespace() function as we want the content to be readable and well-formatted.
at line 784
public
serialize()
at line 789
public
unserialize($data)