Test Failed
Push — master ( a12069...786cd6 )
by Mariano
06:56 queued 03:17
created

Psr18Connection::send()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Mcustiel\Phiremock\Common\Http\Implementation;
6
7
use Mcustiel\Phiremock\Common\Http\RemoteConnectionInterface;
8
use GuzzleHttp\Client as GuzzleClient;
9
use Psr\Http\Client\ClientInterface;
10
use Psr\Http\Message\RequestInterface;
11
use Psr\Http\Message\ResponseInterface;
12
13
class Psr18Connection implements RemoteConnectionInterface
14
{
15
    /**
16
     * @var ClientInterface
17
     */
18
    private $client;
19
20
    public function __construct(ClientInterface $client = null)
21
    {
22
        if (!$client) {
23
            $client = new GuzzleClient();
24
        }
25
        $this->client = $client;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     *
31
     * @see \Mcustiel\Phiremock\Common\Http\RemoteConnectionInterface::send()
32
     */
33
    public function send(RequestInterface $request): ResponseInterface
34
    {
35
        return $this->client->send($request);
36
    }
37
}
38