Completed
Push — master ( 66f0fe...d9d814 )
by Alessandro
06:28
created

Guzzle6Transport   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 25
ccs 3
cts 9
cp 0.3333
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A executeRequest() 0 9 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, [
26
            'Content-Type' => 'application/x-www-form-urlencoded',
27
        ], $body);
28
        $response = $this->client->send($request);
29
30
        return (string) $response->getBody();
31
    }
32
}
33