Get the correct exception class for a given error code
Parameters
$code
int|boolrequired- HTTP status code, or false if unavailable
Source
public static function get_class($code) {
if (!$code) {
return StatusUnknown::class;
}
$class = sprintf('\WpOrg\Requests\Exception\Http\Status%d', $code);
if (class_exists($class)) {
return $class;
}
return StatusUnknown::class;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.