Redirect::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4286
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
3
namespace Zenstruck\ControllerUtil;
4
5
/**
6
 * @author Kevin Bond <[email protected]>
7
 */
8
class Redirect
9
{
10
    const DEFAULT_STATUS_CODE = 302;
11
12
    private $route;
13
    private $parameters;
14
    private $statusCode;
15
16
    /**
17
     * @param string $route
18
     * @param array  $parameters
19
     * @param int    $statusCode
20
     */
21 5
    public function __construct($route, array $parameters = array(), $statusCode = self::DEFAULT_STATUS_CODE)
22
    {
23 5
        $this->route = $route;
24 5
        $this->parameters = $parameters;
25 5
        $this->statusCode = $statusCode;
26 5
    }
27
28
    /**
29
     * @return string
30
     */
31 4
    public function getRoute()
32
    {
33 4
        return $this->route;
34
    }
35
36
    /**
37
     * @return array
38
     */
39 2
    public function getParameters()
40
    {
41 2
        return $this->parameters;
42
    }
43
44
    /**
45
     * @return int
46
     */
47 2
    public function getStatusCode()
48
    {
49 2
        return $this->statusCode;
50
    }
51
}
52