Curl   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 88.24%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 75
ccs 15
cts 17
cp 0.8824
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setOptArray() 0 4 1
A errno() 0 4 1
A error() 0 4 1
A execute() 0 4 1
A getInfo() 0 4 1
A close() 0 4 1
1
<?php
2
3
namespace Postpay\HttpClients;
4
5
class Curl
6
{
7
    /**
8
     * @var resource Curl resource instance.
9
     */
10
    private $ch;
11
12
    /**
13
     * Creates a new Curl entity.
14
     */
15 13
    public function __construct()
16
    {
17 13
        $this->ch = curl_init();
18 13
    }
19
20
    /**
21
     * Set an array of options.
22
     *
23
     * @param array $options
24
     */
25 1
    public function setOptArray(array $options)
26
    {
27 1
        curl_setopt_array($this->ch, $options);
28 1
    }
29
30
    /**
31
     * Return the curl error number.
32
     *
33
     * @return int
34
     */
35 1
    public function errno()
36
    {
37 1
        return curl_errno($this->ch);
38
    }
39
40
    /**
41
     * Return the curl error message.
42
     *
43
     * @return string
44
     */
45
    public function error()
46
    {
47
        return curl_error($this->ch);
48
    }
49
50
    /**
51
     * Send a curl request.
52
     *
53
     * @return mixed
54
     */
55 1
    public function execute()
56
    {
57 1
        return curl_exec($this->ch);
58
    }
59
60
    /**
61
     * Get curl info.
62
     *
63
     * @param $name
64
     *
65
     * @return mixed
66
     */
67 1
    public function getInfo($name)
68
    {
69 1
        return curl_getinfo($this->ch, $name);
70
    }
71
72
    /**
73
     * Close the resource connection to curl.
74
     */
75 1
    public function close()
76
    {
77 1
        curl_close($this->ch);
78 1
    }
79
}
80