AbstractResponse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getRequest() 0 4 1
A getData() 0 4 1
1
<?php
2
/**
3
 * Abstract Response
4
 */
5
6
namespace Bobbyshaw\WatsonVisualRecognition\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
 * Objects of this class or a subclass are usually created in the Request
15
 * object (subclass of AbstractRequest) as the return parameters from the
16
 * send() function.
17
 *
18
 */
19
abstract class AbstractResponse implements ResponseInterface
20
{
21
22
    /**
23
     * The embodied request object.
24
     *
25
     * @var RequestInterface
26
     */
27
    protected $request;
28
29
    /**
30
     * The data contained in the response.
31
     *
32
     * @var mixed
33
     */
34
    protected $data;
35
36
    /**
37
     * Constructor
38
     *
39
     * @param RequestInterface $request the initiating request.
40
     * @param mixed $data
41
     */
42 25
    public function __construct(RequestInterface $request, $data)
43
    {
44 25
        $this->request = $request;
45 25
        $this->data = $data;
46 25
    }
47
48
    /**
49
     * Get the initiating request object.
50
     *
51
     * @return RequestInterface
52
     */
53 1
    public function getRequest()
54
    {
55 1
        return $this->request;
56
    }
57
58
59
    /**
60
     * Get the response data.
61
     *
62
     * @return mixed
63
     */
64 1
    public function getData()
65
    {
66 1
        return $this->data;
67
    }
68
}
69