DataSift\Storyplayer\TestEnvironmentsLib\TestEnvironmentConfig::mergeSystemUnderTestConfig PHP Method

mergeSystemUnderTestConfig() public method

public mergeSystemUnderTestConfig ( $sutConfig )
    public function mergeSystemUnderTestConfig($sutConfig)
    {
        // do we have anything to merge?
        if (!$sutConfig->hasData('roles')) {
            // nothing to merge
            return;
        }
        // get the list of roles
        $sutRoles = $sutConfig->getData('roles');
        // get our config
        $envConfig = $this->getConfig();
        foreach ($sutRoles as $sutRole) {
            foreach ($envConfig->groups as $envDetails) {
                foreach ($envDetails->details->machines as $machine) {
                    if (in_array($sutRole->role, $machine->roles) || in_array('*', $machine->roles)) {
                        if (!isset($machine->params)) {
                            $machine->params = new BaseObject();
                        } else {
                            if (!$machine->params instanceof BaseObject) {
                                $tmp = new BaseObject();
                                $tmp->mergeFrom($machine->params);
                                $machine->params = $tmp;
                            }
                        }
                        $machine->params->mergeFrom($sutRole->params);
                    }
                }
            }
        }
    }