Requests_Exception_HTTP::get_class( int|bool $code ): string

Get the correct exception class for a given error code


Parameters

$code int|bool Required
HTTP status code, or false if unavailable

Top ↑

Return

string Exception class name to use


Top ↑

Source

File: wp-includes/Requests/Exception/HTTP.php. View all references

public static function get_class($code) {
	if (!$code) {
		return 'Requests_Exception_HTTP_Unknown';
	}

	$class = sprintf('Requests_Exception_HTTP_%d', $code);
	if (class_exists($class)) {
		return $class;
	}

	return 'Requests_Exception_HTTP_Unknown';
}


Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.