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

Guzzle6Transport::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Fazland\SkebbyRestClient\Transport;
4
5
use GuzzleHttp\Client;
6
use GuzzleHttp\Psr7\Request;
7
8
class Guzzle6Transport implements TransportInterface
9
{
10
    /**
11
     * @var Client
12
     */
13
    private $client;
14
15 1
    public function __construct(Client $client = null)
16
    {
17 1
        $this->client = $client ?: new Client();
18 1
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function executeRequest($uri, $body)
24
    {
25
        $request = new Request('POST', $uri, [], $body);
26
        $response = $this->client->send($request);
27
28
        return (string) $response->getBody();
29
    }
30
}
31