Passed
Push — master ( 9d60a4...b0dfbc )
by Mariano
04:38
created

GuzzlePsr18Client   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 13
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sendRequest() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Mcustiel\Phiremock\Server\Utils;
4
5
use GuzzleHttp\Client as GuzzleClient;
6
use Psr\Http\Client\ClientInterface;
7
use Psr\Http\Message\RequestInterface;
8
use Psr\Http\Message\ResponseInterface;
9
10
class GuzzlePsr18Client implements ClientInterface
11
{
12
    /** @var GuzzleClient */
13
    private $client;
14
15
    public function __construct(GuzzleClient $client = null)
16
    {
17
        $this->client = $client ?? new GuzzleClient(['allow_redirects' => false]);
18
    }
19
20
    public function sendRequest(RequestInterface $request): ResponseInterface
21
    {
22
        return $this->client->send($request);
23
    }
24
}
25