GET   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 3
c 5
b 1
f 0
lcom 1
cbo 1
dl 0
loc 39
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setBody() 0 4 1
A send() 0 8 2
1
<?php
2
/**
3
 * ©[2016] SugarCRM Inc.  Licensed by SugarCRM under the Apache 2.0 license.
4
 */
5
6
namespace SugarAPI\SDK\Request;
7
8
use SugarAPI\SDK\Request\Abstracts\AbstractRequest;
9
10
class GET extends AbstractRequest {
11
12
    /**
13
     * @inheritdoc
14
     */
15
    protected static $_TYPE = 'GET';
16
17
    /**
18
     * @inheritdoc
19
     */
20
    protected static $_DEFAULT_HEADERS = array(
21
        "Content-Type: application/json"
22
    );
23
24
    /**
25
     * @inheritdoc
26
     *
27
     * Convert Body to Query String
28
     */
29
    public function setBody($body){
30
        $this->body = http_build_query($body);
31
        return $this;
32
    }
33
34
    /**
35
     * @inheritdoc
36
     *
37
     * Configure the URL with Body since Payload is sent via Query String
38
     */
39
    public function send(){
40
        $body = '';
41
        if (!empty($this->body)){
42
            $body = "?".$this->body;
43
        }
44
        $this->setURL($this->url.$body);
45
        return parent::send();
46
    }
47
48
}