[TASK] Rename API for ApplicationContext 41/24541/6
authorSteffen Müller <typo3@t3node.com>
Fri, 11 Oct 2013 00:00:32 +0000 (02:00 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 11 Oct 2013 08:47:58 +0000 (10:47 +0200)
Use the term "applicationContext" instead of "context",
because it is too general and could lead to confusion.

Resolves: #52678
Releases: 6.2
Change-Id: Ib586d9d1eb69e6ca7981ed638d45f7aa5b6e6c70
Reviewed-on: https://review.typo3.org/24541
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/install/Classes/Configuration/Context/DevelopmentPreset.php
typo3/sysext/install/Classes/Configuration/Context/ProductionPreset.php

index 782640d..eb4c672 100644 (file)
@@ -63,7 +63,7 @@ class Bootstrap {
         *
         * @var \TYPO3\CMS\Core\Core\ApplicationContext
         */
-       protected $context;
+       protected $applicationContext;
 
        /**
         * Disable direct creation of this object.
@@ -71,9 +71,9 @@ class Bootstrap {
         *
         * @var string Application context
         */
-       protected function __construct($context) {
+       protected function __construct($applicationContext) {
                $this->requestId = uniqid();
-               $this->context = new ApplicationContext($context);
+               $this->applicationContext = new ApplicationContext($applicationContext);
        }
 
        /**
@@ -92,8 +92,8 @@ class Bootstrap {
        static public function getInstance() {
                if (is_null(self::$instance)) {
                        require_once(__DIR__ . '/ApplicationContext.php');
-                       $context = trim(getenv('TYPO3_CONTEXT'), '"\' ') ? : 'Production';
-                       self::$instance = new \TYPO3\CMS\Core\Core\Bootstrap($context);
+                       $applicationContext = trim(getenv('TYPO3_CONTEXT'), '"\' ') ? : 'Production';
+                       self::$instance = new \TYPO3\CMS\Core\Core\Bootstrap($applicationContext);
                }
                return self::$instance;
        }
@@ -109,13 +109,14 @@ class Bootstrap {
        }
 
        /**
-        * Returns the context this bootstrap was started in.
+        * Returns the application context this bootstrap was started in.
         *
-        * @return \TYPO3\CMS\Core\Core\ApplicationContext The context encapsulated in an object
-        * @internal This is not a public API method, do not use in own extensions. Use \TYPO3\CMS\Core\Utility\GeneralUtility::getContext() instead
+        * @return \TYPO3\CMS\Core\Core\ApplicationContext The application context encapsulated in an object
+        * @internal This is not a public API method, do not use in own extensions.
+        * Use \TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext() instead
         */
-       public function getContext() {
-               return $this->context;
+       public function getApplicationContext() {
+               return $this->applicationContext;
        }
 
        /**
@@ -142,7 +143,7 @@ class Bootstrap {
         */
        public function baseSetup($relativePathPart = '') {
                \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run($relativePathPart);
-               Utility\GeneralUtility::presetContext($this->context);
+               Utility\GeneralUtility::presetApplicationContext($this->applicationContext);
                return $this;
        }
 
index 9748fa4..790208f 100644 (file)
@@ -68,7 +68,7 @@ class GeneralUtility {
         *
         * @var \TYPO3\CMS\Core\Core\ApplicationContext
         */
-       static protected $context = NULL;
+       static protected $applicationContext = NULL;
 
        /*************************
         *
@@ -5023,18 +5023,18 @@ Connection: close
        /**
         * Set the ApplicationContext
         *
-        * This function is used by the Bootstrap to hand over the context. It must not be used anywhere else,
+        * This function is used by the Bootstrap to hand over the application context. It must not be used anywhere else,
         * because the context shall never be changed on runtime!
         *
-        * @param \TYPO3\CMS\Core\Core\ApplicationContext $context
-        * @throws \RuntimeException if context is overriden
+        * @param \TYPO3\CMS\Core\Core\ApplicationContext $applicationContext
+        * @throws \RuntimeException if applicationContext is overriden
         * @internal This is not a public API method, do not use in own extensions
         */
-       static public function presetContext(\TYPO3\CMS\Core\Core\ApplicationContext $context) {
-               if (is_null(static::$context)) {
-                       static::$context = $context;
+       static public function presetApplicationContext(\TYPO3\CMS\Core\Core\ApplicationContext $applicationContext) {
+               if (is_null(static::$applicationContext)) {
+                       static::$applicationContext = $applicationContext;
                } else {
-                       throw new \RuntimeException('Trying to override context which has already been defined!', 1376084316);
+                       throw new \RuntimeException('Trying to override applicationContext which has already been defined!', 1376084316);
                }
        }
 
@@ -5043,7 +5043,7 @@ Connection: close
         *
         * @return \TYPO3\CMS\Core\Core\ApplicationContext
         */
-       static public function getContext() {
-               return static::$context;
+       static public function getApplicationContext() {
+               return static::$applicationContext;
        }
 }
index 4377533..088955e 100644 (file)
@@ -70,7 +70,7 @@ class DevelopmentPreset extends Configuration\AbstractPreset implements Configur
         * @return integer Priority of preset
         */
        public function getPriority() {
-               $context = \TYPO3\CMS\Core\Utility\GeneralUtility::getContext();
+               $context = \TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext();
                $priority = $this->priority;
                if ($context->isDevelopment()) {
                        $priority = $priority + 20;
index b98010c..7d31074 100644 (file)
@@ -70,7 +70,7 @@ class ProductionPreset extends Configuration\AbstractPreset implements Configura
         * @return integer Priority of preset
         */
        public function getPriority() {
-               $context = \TYPO3\CMS\Core\Utility\GeneralUtility::getContext();
+               $context = \TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext();
                $priority = $this->priority;
                if ($context->isProduction()) {
                        $priority = $priority + 20;