Response   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 59
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getStatusCode() 0 4 1
A getContent() 0 4 1
A getContentAsXml() 0 4 1
1
<?php
2
namespace AsimovExpress\AdobeConnect\Http;
3
4
class Response
5
{
6
    /**
7
     * Http status code received.
8
     *
9
     * @var int
10
     */
11
    protected $statusCode;
12
13
    /**
14
     * Http response body.
15
     *
16
     * @var string
17
     */
18
    protected $content;
19
20
    /**
21
     * Initilizes an instance of Response.
22
     *
23
     * @param resource $curl_resource Curl resource instance.
24
     * @param string $content Response content.
25
     */
26
    public function __construct($curl_resource, $content)
27
    {
28
        $info = curl_getinfo($curl_resource);
29
        $this->statusCode = $info['http_code'];
30
        $this->content = $content;
31
    }
32
33
    /**
34
     * Http status code received from the server.
35
     *
36
     * @return int
37
     */
38
    public function getStatusCode()
39
    {
40
        return $this->statusCode;
41
    }
42
43
    /**
44
     * Http response body.
45
     *
46
     * @return string
47
     */
48
    public function getContent()
49
    {
50
        return $this->content;
51
    }
52
53
    /**
54
     * Return a SimpleXMLElement containing the response body.
55
     *
56
     * @return \SimpleXMLElement
57
     */
58
    public function getContentAsXml()
59
    {
60
        return new \SimpleXMLElement($this->content);
61
    }
62
}
63