StarCitizensClient::getResult()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace StarCitizen\Client;
4
5
use GuzzleHttp\Client;
6
use GuzzleHttp\Psr7\Request;
7
8
/**
9
 * Class StarCitizensClient
10
 *
11
 * @package StarCitizen\Client
12
 */
13
class StarCitizensClient
14
{
15
    /**
16
     * Base url
17
     */
18
    const APIURL =  "http://sc-api.com";
19
20
    /**
21
     * @var Client
22
     */
23
    private $client;
24
25
    /**
26
     * StarCitizensClient constructor.
27
     */
28 1
    public function __construct()
29
    {
30 1
        $this->client = new Client(
31
            [
32 1
                'http_error' => false,
33
                'base_uri'   => StarCitizensClient::APIURL
34
            ]
35
        );
36 1
    }
37
38
    /**
39
     * Gets th result based on the params.
40
     *
41
     * @param array $params
42
     *
43
     * @return mixed|\Psr\Http\Message\ResponseInterface
44
     */
45 19
    public function getResult($params = [])
46
    {
47 19
        $request = new Request("GET", '?'.http_build_query($params));
48 19
        return $this->client->send($request);
49
    }
50
}