Requests_Exception_HTTP::get_class()public staticWP 1.0

Get the correct exception class for a given error code

{} It's a method of the class: Requests_Exception_HTTP{}

No Hooks.


String. Exception class name to use


$result = Requests_Exception_HTTP::get_class( $code );
$code(int|true|false) (required)
HTTP status code, or false if unavailable

Code of Requests_Exception_HTTP::get_class() WP 6.0

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';