Scalr::initializeContainer PHP Method

initializeContainer() public static method

Performs preliminary initialization of the DI container
public static initializeContainer ( )
    public static function initializeContainer()
    {
        Container::reset();
        $container = self::getContainer();
        //Dependency injection container config
        require __DIR__ . '/di.php';
    }

Usage Example

Exemplo n.º 1
0
define("CACHEPATH", "{$base}/../cache");
define("SCALR_CONFIG_FILE", APPPATH . '/etc/config.yml');
define("SCALR_CONFIG_CACHE_FILE", CACHEPATH . '/.config');
define("SCALR_VERSION", trim(@file_get_contents(APPPATH . "/etc/version")));
$ADODB_CACHE_DIR = CACHEPATH . "/adodb";
define("SCALR_TEMPLATES_PATH", APPPATH . "/templates/en_US");
// Require autoload definition
$classpath[] = $base;
$classpath[] = $base . "/externals/ZF-1.10.8";
$classpath[] = $base . "/externals/google-api-php-client-git-03102014/src";
set_include_path(get_include_path() . PATH_SEPARATOR . join(PATH_SEPARATOR, $classpath));
require_once SRCPATH . "/autoload.inc.php";
spl_autoload_register("__autoload");
set_error_handler("Scalr::errorHandler");
//Container witn adodb service needs to be defined in the first turn, as much depends on it.
Scalr::initializeContainer();
$idFilePath = APPPATH . '/etc/id';
$id = trim(@file_get_contents($idFilePath));
if (!$id) {
    $uuid = Scalr::GenerateUID();
    $id = dechex(abs(crc32($uuid)));
    $res = @file_put_contents($idFilePath, $id);
    if (!$res) {
        exit("ERROR: Unable to write ID file ({$idFilePath}).");
    }
}
define("SCALR_ID", $id);
// Define log4php contants
define("LOG4PHP_DIR", SRCPATH . '/externals/apache-log4php-2.0.0-incubating/src/main/php');
require_once LOG4PHP_DIR . '/Logger.php';
require_once SRCPATH . '/externals/adodb5-18/adodb-exceptions.inc.php';