‪TYPO3CMS  10.4
TYPO3\CMS\Core\Core\ApplicationContext Class Reference

Public Member Functions

 __construct ($contextString)
 
string __toString ()
 
bool isDevelopment ()
 
bool isProduction ()
 
bool isTesting ()
 
TYPO3 CMS Core Core ApplicationContext getParent ()
 

Protected Attributes

string $contextString
 
string $rootContextString
 
TYPO3 CMS Core Core ApplicationContext $parentContext
 

Detailed Description

The TYPO3 Context object.

A TYPO3 Application context is something like "Production", "Development", "Production/StagingSystem", and is set using the TYPO3_CONTEXT environment variable.

A context can contain arbitrary sub-contexts, which are delimited with slash ("Production/StagingSystem", "Production/Staging/Server1"). The top-level contexts, however, must be one of "Testing", "Development" and "Production".

Mainly, you will use $context->isProduction(), $context->isTesting() and $context->isDevelopment() inside your custom code.

This class is derived from the TYPO3 Flow framework. Credits go to the respective authors.

Definition at line 36 of file ApplicationContext.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Core\ApplicationContext::__construct (   $contextString)

Initialize the context object.

Parameters
string$contextString
Exceptions
Exception‪if the parent context is none of "Development", "Production" or "Testing"

Definition at line 62 of file ApplicationContext.php.

References TYPO3\CMS\Core\Core\ApplicationContext\$contextString.

Member Function Documentation

◆ __toString()

string TYPO3\CMS\Core\Core\ApplicationContext::__toString ( )

Returns the full context string, for example "Development", or "Production/LiveSystem"

Returns
‪string

Definition at line 86 of file ApplicationContext.php.

References TYPO3\CMS\Core\Core\ApplicationContext\$contextString.

◆ getParent()

TYPO3 CMS Core Core ApplicationContext TYPO3\CMS\Core\Core\ApplicationContext::getParent ( )

Returns the parent context object, if any

Returns
‪\TYPO3\CMS\Core\Core\ApplicationContext the parent context or NULL, if there is none

Definition at line 126 of file ApplicationContext.php.

References TYPO3\CMS\Core\Core\ApplicationContext\$parentContext.

◆ isDevelopment()

bool TYPO3\CMS\Core\Core\ApplicationContext::isDevelopment ( )

Returns TRUE if this context is the Development context or a sub-context of it

Returns
‪bool

Definition at line 96 of file ApplicationContext.php.

Referenced by TYPO3\CMS\Core\Page\PageRenderer\loadRequireJs(), and TYPO3\CMS\Install\Controller\SettingsController\systemMaintainerGetListAction().

◆ isProduction()

bool TYPO3\CMS\Core\Core\ApplicationContext::isProduction ( )

Returns TRUE if this context is the Production context or a sub-context of it

Returns
‪bool

Definition at line 106 of file ApplicationContext.php.

◆ isTesting()

bool TYPO3\CMS\Core\Core\ApplicationContext::isTesting ( )

Returns TRUE if this context is the Testing context or a sub-context of it

Returns
‪bool

Definition at line 116 of file ApplicationContext.php.

Referenced by TYPO3\CMS\Core\Core\ClassLoadingInformation\isTestingContext().

Member Data Documentation

◆ $contextString

string TYPO3\CMS\Core\Core\ApplicationContext::$contextString
protected

The (internal) context string; could be something like "Development" or "Development/MyLocalMacBook"

Definition at line 42 of file ApplicationContext.php.

Referenced by TYPO3\CMS\Core\Core\ApplicationContext\__construct(), and TYPO3\CMS\Core\Core\ApplicationContext\__toString().

◆ $parentContext

TYPO3 CMS Core Core ApplicationContext TYPO3\CMS\Core\Core\ApplicationContext::$parentContext
protected

The parent context, or NULL if there is no parent context

Definition at line 54 of file ApplicationContext.php.

Referenced by TYPO3\CMS\Core\Core\ApplicationContext\getParent().

◆ $rootContextString

string TYPO3\CMS\Core\Core\ApplicationContext::$rootContextString
protected

The root context; must be one of "Development", "Testing" or "Production"

Definition at line 48 of file ApplicationContext.php.