WordPress at a glance
function is not described

WP_Http_Streams::test() WP 2.7.0

Determines whether this class can be used for retrieving a URL.

This is a method of the class: WP_Http_Streams

Hooks from the method
Return

true/false. False means this class can not be used, true means it can.

Usage

$var = WP_Http_Streams::test( $args );
$args(array)
Array of request arguments.
Default: empty array

Changelog

Since 2.7.0 Introduced.
Since 3.7.0 Combined with the fsockopen transport and switched to stream_socket_client().

Code of WP Http Streams::test: wp-includes/class-wp-http-streams.php WP 5.3.2

<?php
public static function test( $args = array() ) {
	if ( ! function_exists( 'stream_socket_client' ) ) {
		return false;
	}

	$is_ssl = isset( $args['ssl'] ) && $args['ssl'];

	if ( $is_ssl ) {
		if ( ! extension_loaded( 'openssl' ) ) {
			return false;
		}
		if ( ! function_exists( 'openssl_x509_parse' ) ) {
			return false;
		}
	}

	/**
	 * Filters whether streams can be used as a transport for retrieving a URL.
	 *
	 * @since 2.7.0
	 *
	 * @param bool  $use_class Whether the class can be used. Default true.
	 * @param array $args      Request arguments.
	 */
	return apply_filters( 'use_streams_transport', true, $args );
}