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

Request   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A makeRequest() 0 15 1
A getResponse() 0 4 1
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