AbstractResponse   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 68
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getRequest() 0 4 1
A getData() 0 4 1
A getMessage() 0 4 1
A getCode() 0 4 1
1
<?php
2
/**
3
 * Abstract Response
4
 */
5
6
namespace IBM\Watson\Common\Message;
7
8
/**
9
 * Abstract Response
10
 *
11
 * This abstract class implements ResponseInterface and defines a basic
12
 * set of functions that all Watson Requests are intended to include.
13
 *
14
 * @see ResponseInterface
15
 */
16
abstract class AbstractResponse implements ResponseInterface
17
{
18
    /**
19
     * The embodied request object.
20
     *
21
     * @var RequestInterface
22
     */
23
    protected $request;
24
25
    /**
26
     * The data contained in the response.
27
     *
28
     * @var mixed
29
     */
30
    protected $data;
31
32
    /**
33
     * Create new Response object
34
     *
35
     * @param RequestInterface $request The initiating request
36
     * @param mixed $data
37
     */
38 3
    public function __construct(RequestInterface $request, $data)
39
    {
40 3
        $this->request = $request;
41 3
        $this->data = $data;
42 3
    }
43
44
    /**
45
     * Get the initiating request object.
46
     *
47
     * @return RequestInterface
48
     */
49 3
    public function getRequest()
50
    {
51 3
        return $this->request;
52
    }
53
54
    /**
55
     * Get the response data.
56
     *
57
     * @return mixed
58
     */
59 6
    public function getData()
60
    {
61 6
        return $this->data;
62
    }
63
64
    /**
65
     * Response message
66
     *
67
     * @return null|string A response message from the Watson service
68
     */
69 3
    public function getMessage()
70
    {
71 3
        return null;
72
    }
73
74
    /**
75
     * Response code
76
     *
77
     * @return null|string A response code from the Watson service
78
     */
79 3
    public function getCode()
80
    {
81 3
        return null;
82
    }
83
}
84