diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:56:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:56:49 +0000 |
commit | a415c29efee45520ae252d2aa28f1083a521cd7b (patch) | |
tree | f4ade4b6668ecc0765de7e1424f7c1427ad433ff /wp-includes/Requests/src/Exception/Transport/Curl.php | |
parent | Initial commit. (diff) | |
download | wordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.tar.xz wordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.zip |
Adding upstream version 6.4.3+dfsg1.upstream/6.4.3+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/Requests/src/Exception/Transport/Curl.php')
-rw-r--r-- | wp-includes/Requests/src/Exception/Transport/Curl.php | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/wp-includes/Requests/src/Exception/Transport/Curl.php b/wp-includes/Requests/src/Exception/Transport/Curl.php new file mode 100644 index 0000000..4c0294d --- /dev/null +++ b/wp-includes/Requests/src/Exception/Transport/Curl.php @@ -0,0 +1,80 @@ +<?php +/** + * CURL Transport Exception. + * + * @package Requests\Exceptions + */ + +namespace WpOrg\Requests\Exception\Transport; + +use WpOrg\Requests\Exception\Transport; + +/** + * CURL Transport Exception. + * + * @package Requests\Exceptions + */ +final class Curl extends Transport { + + const EASY = 'cURLEasy'; + const MULTI = 'cURLMulti'; + const SHARE = 'cURLShare'; + + /** + * cURL error code + * + * @var integer + */ + protected $code = -1; + + /** + * Which type of cURL error + * + * EASY|MULTI|SHARE + * + * @var string + */ + protected $type = 'Unknown'; + + /** + * Clear text error message + * + * @var string + */ + protected $reason = 'Unknown'; + + /** + * Create a new exception. + * + * @param string $message Exception message. + * @param string $type Exception type. + * @param mixed $data Associated data, if applicable. + * @param int $code Exception numerical code, if applicable. + */ + public function __construct($message, $type, $data = null, $code = 0) { + if ($type !== null) { + $this->type = $type; + } + + if ($code !== null) { + $this->code = (int) $code; + } + + if ($message !== null) { + $this->reason = $message; + } + + $message = sprintf('%d %s', $this->code, $this->reason); + parent::__construct($message, $this->type, $data, $this->code); + } + + /** + * Get the error message. + * + * @return string + */ + public function getReason() { + return $this->reason; + } + +} |