AbstractResponse::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Gregoriohc\Protean\Common\Messages;
4
5
abstract class AbstractResponse implements ResponseInterface
6
{
7
8
    /**
9
     * The embodied request object.
10
     *
11
     * @var RequestInterface
12
     */
13
    protected $request;
14
15
    /**
16
     * The data contained in the response.
17
     *
18
     * @var mixed
19
     */
20
    protected $data;
21
22
    /**
23
     * Constructor
24
     *
25
     * @param RequestInterface $request the initiating request.
26
     * @param mixed $data
27
     */
28 9
    public function __construct(RequestInterface $request, $data)
29
    {
30 9
        $this->request = $request;
31 9
        $this->data = $data;
32 9
    }
33
34
    /**
35
     * Get the initiating request object.
36
     *
37
     * @return RequestInterface
38
     */
39 3
    public function request()
40
    {
41 3
        return $this->request;
42
    }
43
44
    /**
45
     * Is the transaction cancelled by the user?
46
     *
47
     * @return boolean
48
     */
49 3
    public function isCancelled()
50
    {
51 3
        return false;
52
    }
53
54
    /**
55
     * Get the response data.
56
     *
57
     * @return mixed
58
     */
59 6
    public function data()
60
    {
61 6
        return $this->data;
62
    }
63
}
64