The main system class is responsible for creating the environment within which the Scorpio framework runs. This configures all the low-level details such as logging, reading the core config file, setting up the autoloader and ensures that any critical actions are performed.

This class is referenced in and should only ever be called once.

// init system

// code path

// check if we are on CLI

// fetch a config param
$oParam = system::getConfig()->getDatabase('system');

Certain functionality can be disabled via config params e.g.: the Scorpio error and exception handlers can be prevented from being installed by setting the config options 'system', 'registerErrorHandler' and 'system', 'registerExceptionHandler' to false (string false, no or int 0).


private __construct()

Returns system instance

public static init([$inOptions = array()])

Initialise the base system components ready for use

Takes an array of options for setting basepath and central config location. If not specified, defaults will be used.

public static checkPermissions()

Checks the permissions on variable folders, stops framework if an error is encountered

public static getDirSeparator()

Get the current system directory separator

public static getScriptPath()

Returns the current script path

private static setScriptPath()

Set the script path

public static getScriptRelativePath()

Returns the current script relative path

private static setScriptRelativePath()

Set the script relative path

public static getScriptFilename()

Returns the current script name

private static setScriptFilename()

Set the script name

public static getIsCli()

Returns true if current running on CLI

private static setIsCli()

Sets the status of IsCli

public static registerAutoloader($inAutoloader)

Registers an autoload implementation with spl_autoload_register

This method accepts both strings and arrays as input. For static autoload methods, they can be assigned as a string using: ClassName::autoLoadMethod or the array syntax: array(ClassName, autoLoadMethod)

private static initRegistry([$inOptions = array()])

Sets up the main registry system

public static compareVersion($inVersion)

Compares the version with the current scorpio version.

Returns true if $inVersion is greater than or equal to the current version.

public static getRegistry()

Returns the registry object, creating it if not set

public static getAutoload()

Returns the autoload system object

public static getConfig()

Returns the system config object

public static getLocale()

Returns the system locale object

public static getEventDispatcher()

Returns a system level event dispatcher

<  1  >