Completed
Push — master ( 1e1010...9660b3 )
by Adam
04:08
created

AbstractResponse::getMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Abstract Response
4
 */
5
6
namespace IBM\Watson\Common\Message;
7
8
/**
9
 * Abstract Response
10
 * This abstract class implements RequestInterface and defines a basic
11
 * set of functions that all IBM Watson responses are intended to include.
12
 *
13
 * Requests of this class are usually created using the createRequest
14
 * function of the client and then actioned using methods within this
15
 * class or a class that extends this.
16
 *
17
 * @see ResponseInterface
18
 */
19
abstract class AbstractResponse implements ResponseInterface
20
{
21
    /**
22
     * The embodied request object
23
     *
24
     * @var RequestInterface
25
     */
26
    protected $request;
27
28
    /**
29
     * The data contained in the response
30
     *
31
     * @var mixed
32
     */
33
    protected $data;
34
35
    /**
36
     * Constructor
37
     *
38
     * @param RequestInterface $request the initiating request
39
     * @param mixed $data
40
     */
41 3
    public function __construct(RequestInterface $request, $data)
42
    {
43 3
        $this->request = $request;
44 3
        $this->data = $data;
45 3
    }
46
47
    /**
48
     * Get the initiating request object
49
     *
50
     * @return RequestInterface
51
     */
52 3
    public function getRequest()
53
    {
54 3
        return $this->request;
55
    }
56
57
    /**
58
     * Get the response data
59
     *
60
     * @return mixed
61
     */
62 6
    public function getData()
63
    {
64 6
        return $this->data;
65
    }
66
67
    /**
68
     * Get response message
69
     *
70
     * @return null|string A response message from the API
71
     */
72 3
    public function getMessage()
73
    {
74 3
        return null;
75
    }
76
77
    /**
78
     * Response code
79
     *
80
     * @return null|string A response code from the API
81
     */
82 3
    public function getCode()
83
    {
84 3
        return null;
85
    }
86
}
87