StarCitizensClient   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 38
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getResult() 0 5 1
A __construct() 0 9 1
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
}