summaryrefslogtreecommitdiffstats
path: root/vendor/paypal/paypalhttp/lib/PayPalHttp/Curl.php
blob: 08e6eaf8fa1a461edc702c173543e047fdc019c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

namespace PayPalHttp;

/**
 * Class Curl
 * @package PayPalHttp
 *
 * Curl wrapper used by HttpClient to make curl requests.
 * @see HttpClient
 */
class Curl
{
    protected $curl;

    public function __construct($curl = NULL)
    {

        if (is_null($curl))
        {
            $curl = curl_init();
        }
        $this->curl = $curl;
    }

    public function setOpt($option, $value)
    {
        curl_setopt($this->curl, $option, $value);
        return $this;
    }

    public function close()
    {
        curl_close($this->curl);
        return $this;
    }

    public function exec()
    {
        return curl_exec($this->curl);
    }

    public function errNo()
    {
        return curl_errno($this->curl);
    }

    public function getInfo($option)
    {
        return curl_getinfo($this->curl, $option);
    }

    public function error()
    {
        return curl_error($this->curl);
    }
}