Completed
Push — master ( f5c078...185443 )
by Victor Hugo
10:13
created

AbstractEndpoint::buildURI()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace VictorAvelar\Fixer\Endpoints;
4
5
use VictorAvelar\Fixer\Contracts\ExecutorInterface;
6
use VictorAvelar\Fixer\FixerHttpClient;
7
8
abstract class AbstractEndpoint implements ExecutorInterface
9
{
10
    /**
11
     * Execution method.
12
     */
13
    const REQUEST_METHOD = "GET";
14
15
    /**
16
     * @var FixerHttpClient
17
     */
18
    protected $client;
19
20
    /**
21
     * @var string
22
     */
23
    protected $path = "";
24
25
    /**
26
     * AbstractEndpoint constructor.
27
     *
28
     * @param FixerHttpClient $client
29
     */
30
    public function __construct(FixerHttpClient $client)
31
    {
32
        $this->client = $client;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function execute()
39
    {
40
        return $this->client->request(
41
            self::REQUEST_METHOD,
42
            $this->path,
43
            ['query' => [FixerHttpClient::KEY_NAME => $this->client->getClientKey()]]
44
        );
45
    }
46
}
47