CURL   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 35
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 1
A setUrl() 0 4 1
A setOpt() 0 4 1
A exec() 0 4 1
A close() 0 4 1
A getHandle() 0 4 1
1
<?php
2
3
namespace ocpu\Request\Broker;
4
5
use ocpu\Request\IRequestBrokerSingle;
6
7
class CURL implements IRequestBrokerSingle
8
{
9
    private $request;
10
11
    public function init()
12
    {
13
        $this->request = \curl_init();
14
        \curl_setopt($this->request, CURLOPT_RETURNTRANSFER, true);
15
    }
16
17
    public function setUrl(string $url)
18
    {
19
        curl_setopt($this->request, CURLOPT_URL, $url);
20
    }
21
22
    public function setOpt(int $option, $value): bool
23
    {
24
        return \curl_setopt($this->request, $option, $value);
25
    }
26
27
    public function exec(): string
28
    {
29
        return \curl_exec($this->request);
30
    }
31
32
    public function close(): void
33
    {
34
        \curl_close($this->request);
35
    }
36
37
    public function getHandle()
38
    {
39
        return $this->request;
40
    }
41
}
42