Response   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponseObject() 0 4 1
A setResponseObject() 0 5 1
A getStatusCode() 0 4 1
A setStatusCode() 0 6 2
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