public function writeCurrentProjectConfig(array $config, $projectRoot = null, $merge = false)
    {
        $projectRoot = $projectRoot ?: $this->getProjectRoot();
        if (!$projectRoot) {
            throw new \Exception('Project root not found');
        }
        $this->ensureLocalDir($projectRoot);
        $file = $projectRoot . '/' . $this->config->get('local.project_config');
        if ($merge) {
            $projectConfig = $this->getProjectConfig($projectRoot) ?: [];
            $config = array_merge($projectConfig, $config);
        }
        $yaml = (new Dumper())->dump($config, 10);
        $this->fs->dumpFile($file, $yaml);

        self::$projectConfigs[$projectRoot] = $config;

        return $config;
    }
public function writeCurrentProjectConfig(array $config, $projectRoot = null, $merge = false)
    {
        $projectRoot = $projectRoot ?: $this->getProjectRoot();
        if (!$projectRoot) {
            throw new \Exception('Project root not found');
        }
        $this->ensureLocalDir($projectRoot);
        $file = $projectRoot . '/' . $this->config->get('local.project_config');
        if ($merge) {
            $projectConfig = $this->getProjectConfig($projectRoot) ?: [];
            $config = array_merge($projectConfig, $config);
        }
        $yaml = (new Dumper())->dump($config, 10);
        $this->fs->dumpFile($file, $yaml);

        self::$projectConfigs[$projectRoot] = $config;

        return $config;
    }
public function writeCurrentProjectConfig ( array $ config , $ projectRoot = null , $ merge = false ) { $ projectRoot = $ projectRoot ? : $ this -> getProjectRoot ( ) ; if ( ! $ projectRoot ) { throw new \ Exception ( 'Project root not found' ) ; } $ this -> ensureLocalDir ( $ projectRoot ) ; $ file = $ projectRoot . '/' . $ this -> config -> get ( 'local.project_config' ) ; if ( $ merge ) { $ projectConfig = $ this -> getProjectConfig ( $ projectRoot ) ? : [ ] ; $ config = array_merge ( $ projectConfig , $ config ) ; } $ yaml = ( new Dumper ( ) ) -> dump ( $ config , 10 ) ; $ this -> fs -> dumpFile ( $ file , $ yaml ) ; self :: $ projectConfigs [ $ projectRoot ] = $ config ; return $ config ; }
Write configuration for a project.

Configuration is stored as YAML, in the location configured by
'local.project_config'.

@param array $config
The configuration.
@param string $projectRoot
The project root.
@param bool   $merge
Whether to merge with existing configuration.

@throws \Exception On failure

@return array
The updated project configuration.
Write configuration for a project .