PHP Class Symfony\Component\HttpKernel\Kernel

It manages an environment made of bundles.
Author: Fabien Potencier ([email protected])
Inheritance: implements Symfony\Component\HttpKernel\KernelInterface, implements Symfony\Component\HttpKernel\TerminableInterface
Afficher le fichier Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Свойство Type Description
$booted
$bundleDirs
$bundleMap
$bundles
$classes
$container
$debug
$environment
$name
$rootDir
$startTime

Méthodes publiques

Méthode Description
__clone ( )
__construct ( string $environment, boolean $debug ) Constructor.
addClassesToCache ( array $classes )
boot ( ) Boots the current kernel.
getBundle ( string $name, boolean $first = true ) : Symfony\Component\HttpKernel\Bundle\BundleInterface | Array Returns a bundle and optionally its descendants by its name.
getBundleDirs ( ) : array Gets the directories where bundles can be stored.
getBundleForClass ( string $class ) : string Returns the Bundle name for a given class.
getBundles ( ) : array Gets the registered bundle names.
getCacheDir ( )
getCacheDir ( ) : string Gets the cache directory.
getContainer ( )
getContainer ( ) : Symfony\Component\DependencyInjection\ContainerInterface Gets the current container.
getEnvironment ( )
getEnvironment ( ) : string Gets the environment.
getKernelParameters ( )
getLogDir ( )
getLogDir ( ) : string Gets the log directory.
getName ( )
getName ( ) : string Gets the name of the kernel
getRootDir ( )
getRootDir ( ) : string Gets the application root dir.
getSafeName ( )
getStartTime ( )
getStartTime ( ) : integer Gets the request start time (not available if debug is disabled).
handle ( Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true )
init ( )
isBooted ( ) : boolean Checks whether the current kernel has been booted or not.
isClassInActiveBundle ( string $class ) : boolean Checks if a given class name belongs to an active bundle.
isDebug ( )
isDebug ( ) : boolean Checks if debug mode is enabled.
loadClassCache ( string $name = 'classes', string $extension = '.php' ) Loads the PHP class cache.
locateResource ( string $name, string $dir = null, boolean $first = true ) : string | array Returns the file path for a given resource.
reboot ( ) Reboots the kernel.
registerBundleDirs ( )
registerBundles ( )
registerContainerConfiguration ( Symfony\Component\DependencyInjection\Loader\LoaderInterface $loader )
registerRootDir ( )
serialize ( )
setClassCache ( array $classes ) Used internally.
shutdown ( ) Shutdowns the kernel.
stripComments ( string $source ) : string Removes comments from a PHP source string.
unserialize ( $data )

Méthodes protégées

Méthode Description
buildContainer ( $class, $file )
buildContainer ( ) : ContainerBuilder Builds the service container.
dumpContainer ( Symfony\Component\Config\ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass ) Dumps the service container to PHP code in the cache.
getContainerBaseClass ( ) : string Gets the container's base class.
getContainerClass ( ) : string Gets the container class.
getContainerLoader ( Symfony\Component\DependencyInjection\ContainerInterface $container )
getContainerLoader ( Symfony\Component\DependencyInjection\ContainerInterface $container ) : Symfony\Component\Config\Loader\DelegatingLoader Returns a loader for the container.
getEnvParameters ( )
getEnvParameters ( ) : array Gets the environment parameters.
getHttpKernel ( ) : HttpKernel Gets a http kernel from the container
getKernelParameters ( ) : array Returns the kernel parameters.
initializeBundles ( ) Initializes the data structures related to the bundle management.
initializeContainer ( )
needsReload ( $class, $location )
writeCacheFile ( $file, $content )

Method Details

__clone() public méthode

public __clone ( )

__construct() public méthode

Constructor.
public __construct ( string $environment, boolean $debug )
$environment string The environment
$debug boolean Whether to enable debugging or not

addClassesToCache() public méthode

public addClassesToCache ( array $classes )
$classes array

boot() public méthode

This method boots the bundles, which MUST set the DI container.
public boot ( )

buildContainer() protected méthode

protected buildContainer ( $class, $file )

buildContainer() protected méthode

Builds the service container.
protected buildContainer ( ) : ContainerBuilder
Résultat Symfony\Component\DependencyInjection\ContainerBuilder The compiled service container

dumpContainer() protected méthode

Dumps the service container to PHP code in the cache.
protected dumpContainer ( Symfony\Component\Config\ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass )
$cache Symfony\Component\Config\ConfigCache The config cache
$container Symfony\Component\DependencyInjection\ContainerBuilder The service container
$class string The name of the class to generate
$baseClass string The name of the container's base class

getBundle() public méthode

Returns a bundle and optionally its descendants by its name.
public getBundle ( string $name, boolean $first = true ) : Symfony\Component\HttpKernel\Bundle\BundleInterface | Array
$name string Bundle name
$first boolean Whether to return the first bundle only or together with its descendants
Résultat Symfony\Component\HttpKernel\Bundle\BundleInterface | Array A BundleInterface instance or an array of BundleInterface instances if $first is false

getBundleDirs() public méthode

Gets the directories where bundles can be stored.
public getBundleDirs ( ) : array
Résultat array An array of directories where bundles can be stored

getBundleForClass() public méthode

Returns the Bundle name for a given class.
public getBundleForClass ( string $class ) : string
$class string A class name
Résultat string The Bundle name or null if the class does not belongs to a bundle

getBundles() public méthode

Gets the registered bundle names.
public getBundles ( ) : array
Résultat array An array of registered bundle names

getCacheDir() public méthode

public getCacheDir ( )

getCacheDir() public méthode

Gets the cache directory.
public getCacheDir ( ) : string
Résultat string The cache directory

getContainer() public méthode

public getContainer ( )

getContainer() public méthode

Gets the current container.
public getContainer ( ) : Symfony\Component\DependencyInjection\ContainerInterface
Résultat Symfony\Component\DependencyInjection\ContainerInterface A ContainerInterface instance

getContainerBaseClass() protected méthode

All names except Container must be fully qualified.
protected getContainerBaseClass ( ) : string
Résultat string

getContainerClass() protected méthode

Gets the container class.
protected getContainerClass ( ) : string
Résultat string The container class

getContainerLoader() protected méthode

protected getContainerLoader ( Symfony\Component\DependencyInjection\ContainerInterface $container )
$container Symfony\Component\DependencyInjection\ContainerInterface

getContainerLoader() protected méthode

Returns a loader for the container.
protected getContainerLoader ( Symfony\Component\DependencyInjection\ContainerInterface $container ) : Symfony\Component\Config\Loader\DelegatingLoader
$container Symfony\Component\DependencyInjection\ContainerInterface The service container
Résultat Symfony\Component\Config\Loader\DelegatingLoader The loader

getEnvParameters() protected méthode

protected getEnvParameters ( )

getEnvParameters() protected méthode

Only the parameters starting with "SYMFONY__" are considered.
protected getEnvParameters ( ) : array
Résultat array An array of parameters

getEnvironment() public méthode

public getEnvironment ( )

getEnvironment() public méthode

Gets the environment.
public getEnvironment ( ) : string
Résultat string The current environment

getHttpKernel() protected méthode

Gets a http kernel from the container
protected getHttpKernel ( ) : HttpKernel
Résultat HttpKernel

getKernelParameters() public méthode

public getKernelParameters ( )

getKernelParameters() protected méthode

Returns the kernel parameters.
protected getKernelParameters ( ) : array
Résultat array An array of kernel parameters

getLogDir() public méthode

public getLogDir ( )

getLogDir() public méthode

Gets the log directory.
public getLogDir ( ) : string
Résultat string The log directory

getName() public méthode

public getName ( )

getName() public méthode

Gets the name of the kernel
public getName ( ) : string
Résultat string The kernel name

getRootDir() public méthode

public getRootDir ( )

getRootDir() public méthode

Gets the application root dir.
public getRootDir ( ) : string
Résultat string The application root dir

getSafeName() public méthode

public getSafeName ( )

getStartTime() public méthode

public getStartTime ( )

getStartTime() public méthode

Gets the request start time (not available if debug is disabled).
public getStartTime ( ) : integer
Résultat integer The request start timestamp

handle() public méthode

public handle ( Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true )
$request Symfony\Component\HttpFoundation\Request

init() public méthode

public init ( )

initializeBundles() protected méthode

- the bundles property maps a bundle name to the bundle instance, - the bundleMap property maps a bundle name to the bundle inheritance hierarchy (most derived bundle first).
protected initializeBundles ( )

initializeContainer() protected méthode

protected initializeContainer ( )

isBooted() public méthode

Checks whether the current kernel has been booted or not.
public isBooted ( ) : boolean
Résultat boolean $booted

isClassInActiveBundle() public méthode

Checks if a given class name belongs to an active bundle.
public isClassInActiveBundle ( string $class ) : boolean
$class string A class name
Résultat boolean true if the class belongs to an active bundle, false otherwise

isDebug() public méthode

public isDebug ( )

isDebug() public méthode

Checks if debug mode is enabled.
public isDebug ( ) : boolean
Résultat boolean true if debug mode is enabled, false otherwise

loadClassCache() public méthode

Loads the PHP class cache.
public loadClassCache ( string $name = 'classes', string $extension = '.php' )
$name string The cache name prefix
$extension string File extension of the resulting file

locateResource() public méthode

A Resource can be a file or a directory. The resource name must follow the following pattern: @/path/to/a/file.something where BundleName is the name of the bundle and the remaining part is the relative path in the bundle. If $dir is passed, and the first segment of the path is "Resources", this method will look for a file named: $dir//path/without/Resources before looking in the bundle resource folder.
public locateResource ( string $name, string $dir = null, boolean $first = true ) : string | array
$name string A resource name to locate
$dir string A directory where to look for the resource first
$first boolean Whether to return the first path or paths for all matching bundles
Résultat string | array The absolute path of the resource or an array if $first is false

needsReload() protected méthode

protected needsReload ( $class, $location )

reboot() public méthode

This method is mainly useful when doing functional testing. It is a shortcut for the call to shutdown() and boot().
public reboot ( )

registerBundleDirs() abstract public méthode

abstract public registerBundleDirs ( )

registerBundles() abstract public méthode

abstract public registerBundles ( )

registerContainerConfiguration() abstract public méthode

abstract public registerContainerConfiguration ( Symfony\Component\DependencyInjection\Loader\LoaderInterface $loader )
$loader Symfony\Component\DependencyInjection\Loader\LoaderInterface

registerRootDir() abstract public méthode

abstract public registerRootDir ( )

serialize() public méthode

public serialize ( )

setClassCache() public méthode

Used internally.
public setClassCache ( array $classes )
$classes array

shutdown() public méthode

This method is mainly useful when doing functional testing.
public shutdown ( )

stripComments() public static méthode

We don't use the PHP php_strip_whitespace() function as we want the content to be readable and well-formatted.
public static stripComments ( string $source ) : string
$source string A PHP string
Résultat string The PHP string with the comments removed

unserialize() public méthode

public unserialize ( $data )

writeCacheFile() protected méthode

protected writeCacheFile ( $file, $content )

Property Details

$booted protected_oe property

protected $booted

$bundleDirs protected_oe property

protected $bundleDirs

$bundleMap protected_oe property

protected $bundleMap

$bundles protected_oe property

protected $bundles

$classes protected_oe property

protected $classes

$container protected_oe property

protected $container

$debug protected_oe property

protected $debug

$environment protected_oe property

protected $environment

$name protected_oe property

protected $name

$rootDir protected_oe property

protected $rootDir

$startTime protected_oe property

protected $startTime