Completed
Push — master ( b30e7c...cca158 )
by Julien
02:44 queued 25s
created

Guzzle6::initClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace CanalTP\AbstractGuzzle\Version;
4
5
use GuzzleHttp\Psr7\Request;
6
use GuzzleHttp\Client;
7
use CanalTP\AbstractGuzzle\Guzzle;
8
9
class Guzzle6 extends Guzzle
10
{
11
    /**
12
     * @var Client
13
     */
14
    private $client;
15
16
    /**
17
     * {@InheritDoc}
18
     */
19
    public function __construct($baseUri)
20
    {
21
        parent::__construct($baseUri);
22
23
        $this->initClient();
24
    }
25
26
    /**
27
     * Init Guzzle6 client with base url.
28
     */
29
    public function initClient()
30
    {
31
        $client = new Client(array(
32
            'base_uri' => $this->getBaseUri(),
33
        ));
34
35
        $this->setClient($client);
36
    }
37
38
    /**
39
     * @return Client
40
     */
41
    public function getClient()
42
    {
43
        return $this->client;
44
    }
45
46
    /**
47
     * @param Client $client
48
     *
49
     * @return self
50
     */
51
    public function setClient(Client $client)
52
    {
53
        $this->client = $client;
54
55
        return $this;
56
    }
57
58
    /**
59
     * {@InheritDoc}
60
     */
61
    public function send(Request $request)
62
    {
63
        return $this->client->send($request);
64
    }
65
}
66