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

Guzzle6Transport   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 42.86%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A executeRequest() 0 7 1
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