Completed
Branch develop (e081a1)
by Chris
05:31
created

Request::getResponse()   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 0
1
<?php
2
namespace Cloudflare;
3
4
use GuzzleHttp\Client;
5
6
class Request extends Base
7
{
8
    protected $request;
9
    protected $response;
10
11
    public function makeRequest($request = "", $type = "GET")
12
    {
13
        $client = new Client();
14
        $this->request = $client->request($type, $this->CF->Endpoint . $request, [
15
            'headers' => [
16
                'X-Auth-Key' => $this->CF->APIKEY,
17
                'X-Auth-Email' => $this->CF->Email
18
            ]
19
        ]);
20
21
        $response = (string) $this->request->getBody();
22
        $this->response = @json_decode($response);
23
24
        return $this;
25
    }
26
27
    public function getResponse()
28
    {
29
        return $this->response;
30
    }
31
}
32