src/Config_Command.php
private static function get_wp_config_vars() {
		$wp_cli_original_defined_constants = get_defined_constants();
		$wp_cli_original_defined_vars      = get_defined_vars();
		$wp_cli_original_includes          = get_included_files();

		// phpcs:ignore Squiz.PHP.Eval.Discouraged -- Don't have another way.
		eval( WP_CLI::get_runner()->get_wp_config_code() );

		$wp_config_vars      = self::get_wp_config_diff( get_defined_vars(), $wp_cli_original_defined_vars, 'variable', array( 'wp_cli_original_defined_vars' ) );
		$wp_config_constants = self::get_wp_config_diff( get_defined_constants(), $wp_cli_original_defined_constants, 'constant' );

		foreach ( $wp_config_vars as $name => $value ) {
			if ( 'wp_cli_original_includes' === $value['name'] ) {
				$name_backup = $name;
				break;
			}
		}

		unset( $wp_config_vars[ $name_backup ] );
		$wp_config_vars           = array_values( $wp_config_vars );
		$wp_config_includes       = array_diff( get_included_files(), $wp_cli_original_includes );
		$wp_config_includes_array = [];

		foreach ( $wp_config_includes as $name => $value ) {
			$wp_config_includes_array[] = [
				'name'  => basename( $value ),
				'value' => $value,
				'type'  => 'includes',
			];
		}

		return array_merge( $wp_config_vars, $wp_config_constants, $wp_config_includes_array );
	}
private static function get_wp_config_vars() {
		$wp_cli_original_defined_constants = get_defined_constants();
		$wp_cli_original_defined_vars      = get_defined_vars();
		$wp_cli_original_includes          = get_included_files();

		// phpcs:ignore Squiz.PHP.Eval.Discouraged -- Don't have another way.
		eval( WP_CLI::get_runner()->get_wp_config_code() );

		$wp_config_vars      = self::get_wp_config_diff( get_defined_vars(), $wp_cli_original_defined_vars, 'variable', array( 'wp_cli_original_defined_vars' ) );
		$wp_config_constants = self::get_wp_config_diff( get_defined_constants(), $wp_cli_original_defined_constants, 'constant' );

		foreach ( $wp_config_vars as $name => $value ) {
			if ( 'wp_cli_original_includes' === $value['name'] ) {
				$name_backup = $name;
				break;
			}
		}

		unset( $wp_config_vars[ $name_backup ] );
		$wp_config_vars           = array_values( $wp_config_vars );
		$wp_config_includes       = array_diff( get_included_files(), $wp_cli_original_includes );
		$wp_config_includes_array = [];

		foreach ( $wp_config_includes as $name => $value ) {
			$wp_config_includes_array[] = [
				'name'  => basename( $value ),
				'value' => $value,
				'type'  => 'includes',
			];
		}

		return array_merge( $wp_config_vars, $wp_config_constants, $wp_config_includes_array );
	}
private static function get_wp_config_vars ( ) { $ wp_cli_original_defined_constants = get_defined_constants ( ) ; $ wp_cli_original_defined_vars = get_defined_vars ( ) ; $ wp_cli_original_includes = get_included_files ( ) ; // phpcs:ignore Squiz.PHP.Eval.Discouraged -- Don't have another way. eval ( WP_CLI :: get_runner ( ) -> get_wp_config_code ( ) ) ; $ wp_config_vars = self :: get_wp_config_diff ( get_defined_vars ( ) , $ wp_cli_original_defined_vars , 'variable' , array ( 'wp_cli_original_defined_vars' ) ) ; $ wp_config_constants = self :: get_wp_config_diff ( get_defined_constants ( ) , $ wp_cli_original_defined_constants , 'constant' ) ; foreach ( $ wp_config_vars as $ name => $ value ) { if ( 'wp_cli_original_includes' === $ value [ 'name' ] ) { $ name_backup = $ name ; break ; } } unset ( $ wp_config_vars [ $ name_backup ] ) ; $ wp_config_vars = array_values ( $ wp_config_vars ) ; $ wp_config_includes = array_diff ( get_included_files ( ) , $ wp_cli_original_includes ) ; $ wp_config_includes_array = [ ] ; foreach ( $ wp_config_includes as $ name => $ value ) { $ wp_config_includes_array [ ] = [ 'name' => basename ( $ value ) , 'value' => $ value , 'type' => 'includes' , ] ; } return array_merge ( $ wp_config_vars , $ wp_config_constants , $ wp_config_includes_array ) ; }
Get the array of wp-config.php constants and variables.

@return array
Get the array of wp - config . php constants and variables .