Test Failed
Push — master ( 0ee32e...41c938 )
by Dan
07:10
created

RouterResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 75
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getHandler() 0 4 1
A getStatusCode() 0 4 1
A getVars() 0 4 1
A getNames() 0 4 1
1
<?php
2
/**
3
 * This file is part of the PSR Http Framework.
4
 *
5
 * (c) Dan Smith <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Ds\Router;
11
12
use Ds\Router\Interfaces\RouterResponseInterface;
13
14
/**
15
 * RouterResponse Class.
16
 *
17
 * Contains information about matched Route.
18
 *
19
 * @package Rs\Router
20
 * @author  Dan Smith    <[email protected]>
21
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
22
 * @link    https://github.com/djsmithme/Router
23
 */
24
class RouterResponse implements RouterResponseInterface
25
{
26
    /**
27
     * @var int Response Status Code.
28
     */
29
    protected $statusCode;
30
31
    /**
32
     * @var string|\Closure Route Handler.
33
     */
34
    protected $handler;
35
36
    /**
37
     * @var array Route Query Params.
38
     */
39
    protected $vars = [];
40
41
    /**
42
     * @var array Route Names
43
     */
44
    protected $names = [];
45
46
    /**
47
     * Router Response constructor.
48
     *
49
     * @param int $statusCode
50
     * @param string|\Closure $handler
51
     * @param array $names
52
     * @param array $vars
53
     */
54
    public function __construct(
55
        $statusCode,
56
        $handler,
57
        array $names = [],
58
        array $vars = []
59
    )
60
    {
61
        $this->statusCode = $statusCode;
62
        $this->handler = $handler;
63
        $this->names = $names;
64
        $this->vars = $vars;
65
    }
66
67
    /**
68
     * @inheritdoc
69
     */
70
    public function getHandler()
71
    {
72
        return $this->handler;
73
    }
74
75
    /**
76
     * @inheritdoc
77
     */
78
    public function getStatusCode()
79
    {
80
        return $this->statusCode;
81
    }
82
83
    /**
84
     * @inheritdoc
85
     */
86
    public function getVars()
87
    {
88
        return $this->vars;
89
    }
90
91
    /**
92
     * @inheritdoc
93
     */
94
    public function getNames()
95
    {
96
        return $this->names;
97
    }
98
}
99