GuzzleHttpClient   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 7 1
A request() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the Nexylan packages.
5
 *
6
 * (c) Nexylan SAS <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Nexy\PayboxDirect\HttpClient;
13
14
use GuzzleHttp\Client;
15
16
/**
17
 * @author Sullivan Senechal <[email protected]>
18
 */
19
final class GuzzleHttpClient extends AbstractHttpClient
20
{
21
    /**
22
     * @var Client
23
     */
24
    private $client;
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function init()
30
    {
31
        $this->client = new Client([
32
            'base_uri' => $this->baseUrl,
33
            'timeout' => $this->timeout,
34
        ]);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    protected function request($parameters)
41
    {
42
        $response = $this->client->post('', [
43
            'form_params' => $parameters,
44
        ]);
45
46
        return (string) $response->getBody();
47
    }
48
}
49