php/WP_CLI/Configurator.php
public function merge_yml( $path, $current_alias = null ) {
		$yaml = self::load_yml( $path );
		if ( ! empty( $yaml['_']['inherit'] ) ) {
			$this->merge_yml( $yaml['_']['inherit'], $current_alias );
		}
		// Prepare the base path for absolutized alias paths
		$yml_file_dir = $path ? dirname( $path ) : false;
		foreach ( $yaml as $key => $value ) {
			if ( preg_match( '#' . self::ALIAS_REGEX . '#', $key ) ) {
				$this->aliases[ $key ] = array();
				$is_alias              = false;
				foreach ( self::$alias_spec as $i ) {
					if ( isset( $value[ $i ] ) ) {
						if ( 'path' === $i && ! isset( $value['ssh'] ) ) {
							self::absolutize( $value[ $i ], $yml_file_dir );
						}
						$this->aliases[ $key ][ $i ] = $value[ $i ];
						$is_alias                    = true;
					}
				}
				// If it's not an alias, it might be a group of aliases
				if ( ! $is_alias && is_array( $value ) ) {
					$alias_group = array();
					foreach ( $value as $i => $k ) {
						if ( preg_match( '#' . self::ALIAS_REGEX . '#', $k ) ) {
							$alias_group[] = $k;
						}
					}
					$this->aliases[ $key ] = $alias_group;
				}
			} elseif ( ! isset( $this->spec[ $key ] ) || false === $this->spec[ $key ]['file'] ) {
				if ( isset( $this->extra_config[ $key ] )
					&& ! empty( $yaml['_']['merge'] )
					&& is_array( $this->extra_config[ $key ] )
					&& is_array( $value ) ) {
					$this->extra_config[ $key ] = array_merge( $this->extra_config[ $key ], $value );
				} else {
					$this->extra_config[ $key ] = $value;
				}
			} elseif ( $this->spec[ $key ]['multiple'] ) {
				self::arrayify( $value );
				$this->config[ $key ] = array_merge( $this->config[ $key ], $value );
			} else {
				if ( $current_alias && in_array( $key, self::$alias_spec, true ) ) {
					continue;
				}
				$this->config[ $key ] = $value;
			}
		}
	}
public function merge_yml( $path, $current_alias = null ) {
		$yaml = self::load_yml( $path );
		if ( ! empty( $yaml['_']['inherit'] ) ) {
			$this->merge_yml( $yaml['_']['inherit'], $current_alias );
		}
		// Prepare the base path for absolutized alias paths
		$yml_file_dir = $path ? dirname( $path ) : false;
		foreach ( $yaml as $key => $value ) {
			if ( preg_match( '#' . self::ALIAS_REGEX . '#', $key ) ) {
				$this->aliases[ $key ] = array();
				$is_alias              = false;
				foreach ( self::$alias_spec as $i ) {
					if ( isset( $value[ $i ] ) ) {
						if ( 'path' === $i && ! isset( $value['ssh'] ) ) {
							self::absolutize( $value[ $i ], $yml_file_dir );
						}
						$this->aliases[ $key ][ $i ] = $value[ $i ];
						$is_alias                    = true;
					}
				}
				// If it's not an alias, it might be a group of aliases
				if ( ! $is_alias && is_array( $value ) ) {
					$alias_group = array();
					foreach ( $value as $i => $k ) {
						if ( preg_match( '#' . self::ALIAS_REGEX . '#', $k ) ) {
							$alias_group[] = $k;
						}
					}
					$this->aliases[ $key ] = $alias_group;
				}
			} elseif ( ! isset( $this->spec[ $key ] ) || false === $this->spec[ $key ]['file'] ) {
				if ( isset( $this->extra_config[ $key ] )
					&& ! empty( $yaml['_']['merge'] )
					&& is_array( $this->extra_config[ $key ] )
					&& is_array( $value ) ) {
					$this->extra_config[ $key ] = array_merge( $this->extra_config[ $key ], $value );
				} else {
					$this->extra_config[ $key ] = $value;
				}
			} elseif ( $this->spec[ $key ]['multiple'] ) {
				self::arrayify( $value );
				$this->config[ $key ] = array_merge( $this->config[ $key ], $value );
			} else {
				if ( $current_alias && in_array( $key, self::$alias_spec, true ) ) {
					continue;
				}
				$this->config[ $key ] = $value;
			}
		}
	}
public function merge_yml ( $ path , $ current_alias = null ) { $ yaml = self :: load_yml ( $ path ) ; if ( ! empty ( $ yaml [ '_' ] [ 'inherit' ] ) ) { $ this -> merge_yml ( $ yaml [ '_' ] [ 'inherit' ] , $ current_alias ) ; } // Prepare the base path for absolutized alias paths $ yml_file_dir = $ path ? dirname ( $ path ) : false ; foreach ( $ yaml as $ key => $ value ) { if ( preg_match ( '#' . self :: ALIAS_REGEX . '#' , $ key ) ) { $ this -> aliases [ $ key ] = array ( ) ; $ is_alias = false ; foreach ( self :: $ alias_spec as $ i ) { if ( isset ( $ value [ $ i ] ) ) { if ( 'path' === $ i && ! isset ( $ value [ 'ssh' ] ) ) { self :: absolutize ( $ value [ $ i ] , $ yml_file_dir ) ; } $ this -> aliases [ $ key ] [ $ i ] = $ value [ $ i ] ; $ is_alias = true ; } } // If it's not an alias, it might be a group of aliases if ( ! $ is_alias && is_array ( $ value ) ) { $ alias_group = array ( ) ; foreach ( $ value as $ i => $ k ) { if ( preg_match ( '#' . self :: ALIAS_REGEX . '#' , $ k ) ) { $ alias_group [ ] = $ k ; } } $ this -> aliases [ $ key ] = $ alias_group ; } } elseif ( ! isset ( $ this -> spec [ $ key ] ) || false === $ this -> spec [ $ key ] [ 'file' ] ) { if ( isset ( $ this -> extra_config [ $ key ] ) && ! empty ( $ yaml [ '_' ] [ 'merge' ] ) && is_array ( $ this -> extra_config [ $ key ] ) && is_array ( $ value ) ) { $ this -> extra_config [ $ key ] = array_merge ( $ this -> extra_config [ $ key ] , $ value ) ; } else { $ this -> extra_config [ $ key ] = $ value ; } } elseif ( $ this -> spec [ $ key ] [ 'multiple' ] ) { self :: arrayify ( $ value ) ; $ this -> config [ $ key ] = array_merge ( $ this -> config [ $ key ] , $ value ) ; } else { if ( $ current_alias && in_array ( $ key , self :: $ alias_spec , true ) ) { continue ; } $ this -> config [ $ key ] = $ value ; } } }
Load a YAML file of parameters into scope.

@param string $path Path to YAML file.
Load a YAML file of parameters into scope .