WP_CLI

RequestsLibrary::set_sourcepublic staticWP-CLI 1.0

Set the source of the library.

Method of the class: RequestsLibrary{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = RequestsLibrary::set_source( $source );
$source(string) (required)
The source to set.

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

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

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

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

	self::$source = $source;
}