WP_CLI

Configurator::merge_array()publicWP-CLI 1.0

Merge an array of values into the configurator config.

Method of the class: Configurator{}

No Hooks.

Return

null. Nothing.

Usage

$Configurator = new Configurator();
$Configurator->merge_array( $config );
$config(array) (required)
-

Configurator::merge_array() code WP-CLI 2.8.0-alpha

public function merge_array( $config ) {
	foreach ( $this->spec as $key => $details ) {
		if ( false !== $details['runtime'] && isset( $config[ $key ] ) ) {
			$value = $config[ $key ];

			if ( 'require' === $key ) {
				$value = Utils\expand_globs( $value );
			}

			if ( $details['multiple'] ) {
				self::arrayify( $value );
				$this->config[ $key ] = array_merge( $this->config[ $key ], $value );
			} else {
				$this->config[ $key ] = $value;
			}
		}
	}
}