balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

cURL.php (919B)


      1 <?php
      2 
      3 class Requests_Exception_Transport_cURL extends Requests_Exception_Transport {
      4 
      5 	const EASY  = 'cURLEasy';
      6 	const MULTI = 'cURLMulti';
      7 	const SHARE = 'cURLShare';
      8 
      9 	/**
     10 	 * cURL error code
     11 	 *
     12 	 * @var integer
     13 	 */
     14 	protected $code = -1;
     15 
     16 	/**
     17 	 * Which type of cURL error
     18 	 *
     19 	 * EASY|MULTI|SHARE
     20 	 *
     21 	 * @var string
     22 	 */
     23 	protected $type = 'Unknown';
     24 
     25 	/**
     26 	 * Clear text error message
     27 	 *
     28 	 * @var string
     29 	 */
     30 	protected $reason = 'Unknown';
     31 
     32 	public function __construct($message, $type, $data = null, $code = 0) {
     33 		if ($type !== null) {
     34 			$this->type = $type;
     35 		}
     36 
     37 		if ($code !== null) {
     38 			$this->code = $code;
     39 		}
     40 
     41 		if ($message !== null) {
     42 			$this->reason = $message;
     43 		}
     44 
     45 		$message = sprintf('%d %s', $this->code, $this->reason);
     46 		parent::__construct($message, $this->type, $data, $this->code);
     47 	}
     48 
     49 	/**
     50 	 * Get the error message
     51 	 */
     52 	public function getReason() {
     53 		return $this->reason;
     54 	}
     55 
     56 }