class environment

internal  
 

Utility class for environment detection.

Constants

ENV_PRODUCTION

ENV_DEVELOPMENT

ENV_TESTING

Methods

static bool
is_development()

Checks if the application is currently running in development mode.

static bool
is_production()

Checks if the application is currently running in production mode.

static bool
is_testing()

Checks if the application is currently running in testing mode.

static string
get_environment()

Returns the current environment name based on multiple discovery factors.

Details

at line 41
static bool is_development()

Checks if the application is currently running in development mode.

Return Value

bool

True if in development mode

at line 51
static bool is_production()

Checks if the application is currently running in production mode.

Return Value

bool

True if in production mode

at line 61
static bool is_testing()

Checks if the application is currently running in testing mode.

Return Value

bool

True if in testing mode

at line 78
static string get_environment()

Returns the current environment name based on multiple discovery factors.

Priority:

  1. PHPUNIT_TEST constant (Testing)
  2. MOODLE_ENV environment variable
  3. $CFG->middag_env configuration
  4. Moodle Debug Mode (Developer level implies Development)
  5. Default: Production

Return Value

string

the detected environment name