Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php
2
 
3
namespace Guzzle\Http\Exception;
4
 
5
use Guzzle\Http\Curl\CurlHandle;
6
 
7
/**
8
 * cURL request exception
9
 */
10
class CurlException extends RequestException
11
{
12
    private $curlError;
13
    private $curlErrorNo;
14
    private $handle;
15
    private $curlInfo = array();
16
 
17
    /**
18
     * Set the cURL error message
19
     *
20
     * @param string $error  Curl error
21
     * @param int    $number Curl error number
22
     *
23
     * @return self
24
     */
25
    public function setError($error, $number)
26
    {
27
        $this->curlError = $error;
28
        $this->curlErrorNo = $number;
29
 
30
        return $this;
31
    }
32
 
33
    /**
34
     * Set the associated curl handle
35
     *
36
     * @param CurlHandle $handle Curl handle
37
     *
38
     * @return self
39
     */
40
    public function setCurlHandle(CurlHandle $handle)
41
    {
42
        $this->handle = $handle;
43
 
44
        return $this;
45
    }
46
 
47
    /**
48
     * Get the associated cURL handle
49
     *
50
     * @return CurlHandle|null
51
     */
52
    public function getCurlHandle()
53
    {
54
        return $this->handle;
55
    }
56
 
57
    /**
58
     * Get the associated cURL error message
59
     *
60
     * @return string|null
61
     */
62
    public function getError()
63
    {
64
        return $this->curlError;
65
    }
66
 
67
    /**
68
     * Get the associated cURL error number
69
     *
70
     * @return int|null
71
     */
72
    public function getErrorNo()
73
    {
74
        return $this->curlErrorNo;
75
    }
76
 
77
    /**
78
     * Returns curl information about the transfer
79
     *
80
     * @return array
81
     */
82
    public function getCurlInfo()
83
    {
84
        return $this->curlInfo;
85
    }
86
 
87
    /**
88
     * Set curl transfer information
89
     *
90
     * @param array $info Array of curl transfer information
91
     *
92
     * @return self
93
     * @link http://php.net/manual/en/function.curl-getinfo.php
94
     */
95
    public function setCurlInfo(array $info)
96
    {
97
        $this->curlInfo = $info;
98
 
99
        return $this;
100
    }
101
}