Completed
Push — v3 ( d12fea )
by Beñat
05:39
created

GuzzleHttp::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Stack Exchange Api Client library.
5
 *
6
 * Copyright (c) 2014-2016 Beñat Espiña <[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 BenatEspina\StackExchangeApiClient\Infrastructure\HHttp\Guzzle;
13
14
use BenatEspina\StackExchangeApiClient\Domain\Model\Http;
15
use GuzzleHttp\Client;
16
17
/**
18
 * The Guzzle implementation of Http domain class.
19
 *
20
 * @author Beñat Espiña <[email protected]>
21
 */
22
final class GuzzleHttp implements Http
23
{
24
    const FILTER_ALL = '!*KKtQAaxTFOmbVzM';
25
26
    //TODO: REMEMBER: 'base_uri' => 'https://api.stackexchange.com/2.2',
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
Unused Code Comprehensibility introduced by
40% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
27
28
    /**
29
     * The Guzzle client.
30
     *
31
     * @var Client
32
     */
33
    private $client;
34
35
    /**
36
     * Constructor.
37
     *
38
     * @param Client $aClient The Guzzle client
39
     */
40
    public function __construct(Client $aClient)
41
    {
42
        $this->client = $aClient;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function get($url, $params)
49
    {
50
        return $this->client->get($url, ['query' => $params]);
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function post($url, $params)
57
    {
58
        return $this->client->post($url, ['form_params' => $params]);
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function put($url, $params)
65
    {
66
        return $this->client->post($url, ['form_params' => $params]);
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function delete($url, $params)
73
    {
74
        return $this->client->post($url, ['form_params' => $params]);
75
    }
76
}
77