Completed
Push — master ( 5f5045...66f0fe )
by Alessandro
07:07
created

CurlExtensionTransport   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 23
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A executeRequest() 0 17 1
1
<?php
2
3
namespace Fazland\SkebbyRestClient\Transport;
4
5
class CurlExtensionTransport implements TransportInterface
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10 8
    public function executeRequest($uri, $body)
11
    {
12 8
        $curl = curl_init();
13
14 8
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
15 8
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
16 8
        curl_setopt($curl, CURLOPT_TIMEOUT, 60);
17 8
        curl_setopt($curl, CURLOPT_POST, 1);
18 8
        curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
19 8
        curl_setopt($curl, CURLOPT_URL, $uri);
20
21 8
        $response = curl_exec($curl);
22
23 8
        curl_close($curl);
24
25 8
        return $response;
26
    }
27
}
28