DataSift\Storyplayer\ConfigLib\ActiveConfig::init PHP Метод

init() публичный Метод

public init ( DataSift\Storyplayer\Injectables $injectables )
$injectables DataSift\Storyplayer\Injectables
    public function init(Injectables $injectables)
    {
        // we start off with the built-in config
        $this->mergeData('storyplayer', $injectables->defaultConfig);
        // these are the initial variables we want
        $this->setData('storyplayer.ipAddress', $this->getHostIpAddress());
        $this->setData('storyplayer.currentDir', getcwd());
        $this->setData('storyplayer.user.home', getenv('HOME'));
        // we also want to link in the hosts and roles tables, to make
        // it a lot easier for Prose modules
        $activeConfig = $this->getConfig();
        $runtimeConfig = $injectables->getRuntimeConfig();
        $runtimeConfigManager = $injectables->getRuntimeConfigManager();
        $testEnvName = $injectables->activeTestEnvironmentName;
        $hostsTable = $runtimeConfigManager->getTable($runtimeConfig, 'hosts');
        if (!isset($hostsTable->{$testEnvName})) {
            $hostsTable->{$testEnvName} = new BaseObject();
        }
        $activeConfig->hosts = $hostsTable->{$testEnvName};
        $rolesTable = $runtimeConfigManager->getTable($runtimeConfig, 'roles');
        if (!isset($rolesTable->{$testEnvName})) {
            $rolesTable->{$testEnvName} = new BaseObject();
        }
        $activeConfig->roles = $rolesTable->{$testEnvName};
    }