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

CurlExtensionTransport::executeRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 11
cts 11
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 2
crap 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