Response::setResponseObject()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Vectorface\SnappyRouter\Response;
4
5
/**
6
 * The response to be returned to the client.
7
 * @copyright Copyright (c) 2014, VectorFace, Inc.
8
 * @author Dan Bruce <[email protected]>
9
 */
10
class Response extends AbstractResponse
11
{
12
13
    private $responseObject; // the serializeable response object
14
    private $statusCode; // the http response code
15
16
    /**
17
     * Returns the serializeable response object.
18
     * @return mixed The serializeable response object.
19
     */
20 23
    public function getResponseObject()
21
    {
22 23
        return $this->responseObject;
23
    }
24
25
    /**
26
     * Sets the serializeable response object.
27
     * @param mixed $responseObject The serializeable response object.
28
     * @return ResponseInterface Returns $this.
29
     */
30 23
    public function setResponseObject($responseObject)
31
    {
32 23
        $this->responseObject = $responseObject;
33 23
        return $this;
34
    }
35
36
    /**
37
     * Returns the HTTP status code associated with this response.
38
     * @return integer The HTTP status code associated with this response.
39
     */
40 8
    public function getStatusCode()
41
    {
42 8
        return $this->statusCode;
43
    }
44
45
    /**
46
     * Sets the HTTP status code associated with this response.
47
     * @param int $statusCode The HTTP status code associated with this response.
48
     * @return ResponseInterface Returns $this.
49
     */
50 23
    public function setStatusCode($statusCode)
51
    {
52 23
        $statusCode = intval($statusCode);
53 23
        $this->statusCode = ($statusCode > 0) ? $statusCode : self::RESPONSE_OK;
54 23
        return $this;
55
    }
56
}
57