WP_CLI

RequestsLibrary::set_versionpublic staticWP-CLI 1.0

Set the version of the library.

Method of the class: RequestsLibrary{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = RequestsLibrary::set_version( $version );
$version(string) (required)
The version to set.

RequestsLibrary::set_version() code WP-CLI 2.13.0-alpha

public static function set_version( $version ) {
	if ( ! is_string( $version ) ) {
		throw new RuntimeException( 'RequestsLibrary::$version must be a string.' );
	}

	if ( ! in_array( $version, self::VALID_VERSIONS, true ) ) {
		throw new RuntimeException(
			sprintf(
				'Invalid RequestsLibrary::$version, must be one of: %s.',
				implode( ', ', self::VALID_VERSIONS )
			)
		);
	}

	WP_CLI::debug( 'Setting RequestsLibrary::$version to ' . $version, 'bootstrap' );

	self::$version = $version;
}