TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Core\ApplicationContext Class Reference

Public Member Functions

 __construct ($contextString)
 
 __toString ()
 
 isDevelopment ()
 
 isProduction ()
 
 isTesting ()
 
 getParent ()
 

Protected Attributes

 $contextString
 
 $rootContextString
 
 $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 33 of file ApplicationContext.php.

Constructor & Destructor Documentation

◆ __construct()

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

Initialize the context object.

Parameters
string$contextString
Exceptions

Definition at line 62 of file ApplicationContext.php.

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

Member Function Documentation

◆ __toString()

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

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

Returns
string

Definition at line 87 of file ApplicationContext.php.

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

◆ getParent()

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

Returns the parent context object, if any

Returns
the parent context or NULL, if there is none

Definition at line 131 of file ApplicationContext.php.

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

◆ isDevelopment()

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 98 of file ApplicationContext.php.

◆ isProduction()

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 109 of file ApplicationContext.php.

◆ isTesting()

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 120 of file ApplicationContext.php.

Member Data Documentation

◆ $contextString

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

◆ $parentContext

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

◆ $rootContextString

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

Definition at line 47 of file ApplicationContext.php.