From 7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 7 Jan 2020 13:06:14 +0100 Subject: Added wordpress --- .../wp-includes/Requests/Exception/HTTP.php | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 srcs/wordpress/wp-includes/Requests/Exception/HTTP.php (limited to 'srcs/wordpress/wp-includes/Requests/Exception/HTTP.php') diff --git a/srcs/wordpress/wp-includes/Requests/Exception/HTTP.php b/srcs/wordpress/wp-includes/Requests/Exception/HTTP.php new file mode 100644 index 0000000..9ac6a87 --- /dev/null +++ b/srcs/wordpress/wp-includes/Requests/Exception/HTTP.php @@ -0,0 +1,71 @@ +reason = $reason; + } + + $message = sprintf('%d %s', $this->code, $this->reason); + parent::__construct($message, 'httpresponse', $data, $this->code); + } + + /** + * Get the status message + */ + public function getReason() { + return $this->reason; + } + + /** + * Get the correct exception class for a given error code + * + * @param int|bool $code HTTP status code, or false if unavailable + * @return string Exception class name to use + */ + 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'; + } +} \ No newline at end of file -- cgit