From 842d1217d3ff3ad94eb22a8b05422227a34974b3 Mon Sep 17 00:00:00 2001 From: Katherine Bailey <katherine@katbailey.net> Date: Mon, 6 Aug 2012 12:11:30 -0700 Subject: [PATCH] Various coding standards fixes, cleanup and documentation fixes --- core/includes/bootstrap.inc | 4 ++++ core/includes/install.core.inc | 5 ++++- .../Compiler/RegisterKernelListenersPass.php | 6 ++---- core/lib/Drupal/Core/DrupalKernel.php | 18 ++++++++++++++---- core/lib/Drupal/Core/ExceptionController.php | 4 ++-- core/modules/system/tests/http.php | 1 - core/modules/system/tests/https.php | 1 - 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 7c2f886660d3..7daf311fc25b 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2632,6 +2632,10 @@ function drupal_language_initialize() { * directly. * * @see Drupal\Core\Language\LanguageManager + * + * @param $type + * The type of language object needed, e.g. LANGUAGE_TYPE_INTERFACE. Passing + * NULL invokes a reset of the statically stored language type objects. */ function language_manager($type = NULL) { // Keep track of whether we are in a multilingual environment. diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index e70a4ad2cef4..0481570efee4 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1412,7 +1412,10 @@ function install_bootstrap_full(&$install_state) { // Clear the module list that was overriden earlier in the process. // This will allow all freshly installed modules to be loaded. module_list_reset(); - // @todo Figure out how best to handle the Kernel constructor parameters. + // @todo The constructor parameters for the Kernel class are for environment, + // e.g. 'prod', 'dev', and a boolean indicating whether it is in debug mode. + // Drupal does not currently make use of either of these, though that may + // change with http://drupal.org/node/1537198. $kernel = new DrupalKernel('prod', FALSE); $kernel->boot(); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); diff --git a/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterKernelListenersPass.php b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterKernelListenersPass.php index 5b1a9aba896d..19388faed384 100644 --- a/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterKernelListenersPass.php +++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterKernelListenersPass.php @@ -12,10 +12,8 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -class RegisterKernelListenersPass implements CompilerPassInterface -{ - public function process(ContainerBuilder $container) - { +class RegisterKernelListenersPass implements CompilerPassInterface { + public function process(ContainerBuilder $container) { if (!$container->hasDefinition('dispatcher')) { return; } diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 673731043783..2a26dbad0160 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -15,20 +15,30 @@ /** * The DrupalKernel class is the core of Drupal itself. + * + * This class is responsible for building the Dependency Injection Container and + * also deals with the registration of bundles. It allows registered bundles to + * add their services to the container. Core provides the CoreBundle, which adds + * the services required for all core subsystems. Each module can then add its + * own bundle, i.e. a subclass of Symfony\Component\HttpKernel\Bundle, to + * register services to the container. */ class DrupalKernel extends Kernel { + /** + * Returns an array of available bundles. + */ public function registerBundles() { $bundles = array( new CoreBundle(), ); - // TODO: Remove the necessity of calling system_list() to find out which + // @todo Remove the necessity of calling system_list() to find out which // bundles exist. See http://drupal.org/node/1331486 $modules = array_keys(system_list('module_enabled')); foreach ($modules as $module) { $camelized = ContainerBuilder::camelize($module); - $class = "\Drupal\\{$module}\\{$camelized}Bundle"; + $class = "Drupal\\{$module}\\{$camelized}Bundle"; if (class_exists($class)) { $bundles[] = new $class(); } @@ -42,8 +52,8 @@ public function registerBundles() { */ protected function initializeContainer() { // @todo We should be compiling the container and dumping to php so we don't - // have to recompile every time. There is a separate issue for this, see - // http://drupal.org/node/1668892. + // have to recompile every time. There is a separate issue for this, see + // http://drupal.org/node/1668892. $this->container = $this->buildContainer(); $this->container->set('kernel', $this); drupal_container($this->container); diff --git a/core/lib/Drupal/Core/ExceptionController.php b/core/lib/Drupal/Core/ExceptionController.php index e3026717a0ff..1627021fe541 100644 --- a/core/lib/Drupal/Core/ExceptionController.php +++ b/core/lib/Drupal/Core/ExceptionController.php @@ -36,8 +36,8 @@ class ExceptionController extends ContainerAware { * and the name of the method to call, we can't just register it to the DIC * the regular way. * - * @todo: This probably doesn't belong here, but I'm not sure where would be a better - * place to put it... in a class of its own? + * @todo This probably doesn't belong here, but I'm not sure where would be a + * better place to put it... in a class of its own? */ public static function getExceptionListener(Container $container) { $negotiation = $container->get('content_negotiation'); diff --git a/core/modules/system/tests/http.php b/core/modules/system/tests/http.php index 91ad800422a1..297e3c749db3 100644 --- a/core/modules/system/tests/http.php +++ b/core/modules/system/tests/http.php @@ -37,6 +37,5 @@ drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); $kernel = new DrupalKernel('prod', FALSE); -$kernel->boot(); $response = $kernel->handle($request)->prepare($request)->send(); $kernel->terminate($request, $response); diff --git a/core/modules/system/tests/https.php b/core/modules/system/tests/https.php index f5f7ce7006f7..369116d644ed 100644 --- a/core/modules/system/tests/https.php +++ b/core/modules/system/tests/https.php @@ -36,6 +36,5 @@ drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); $kernel = new DrupalKernel('prod', FALSE); -$kernel->boot(); $response = $kernel->handle($request)->prepare($request)->send(); $kernel->terminate($request, $response); -- GitLab