Passed
Push — master ( d0cb1f...119eae )
by Sebastian
05:14
created

RedirectException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 4
c 1
b 0
f 1
dl 0
loc 26
ccs 0
cts 7
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 3 1
A setPath() 0 3 1
1
<?php
2
3
/**
4
 * Linna Framework.
5
 *
6
 * @author Sebastian Rapetti <[email protected]>
7
 * @copyright (c) 2018, Sebastian Rapetti
8
 * @license http://opensource.org/licenses/MIT MIT License
9
 */
10
declare(strict_types=1);
11
12
namespace Linna\Router\Exception;
13
14
use Exception;
15
16
/**
17
 * Redirect Exception.
18
 * This class should be used to stop execution when a redirection to another
19
 * route/path is requred. $path in setPath() method, must be a value present
20
 * in at least one Route inside routes collection passed to the Router object.
21
 */
22
class RedirectException extends Exception
23
{
24
    /**
25
     * @var string Path on which to be redirected.
26
     */
27
    private $path = '';
28
29
    /**
30
     * Set path.
31
     *
32
     * @param string $path Path on which to be redirected.
33
     * @return void
34
     */
35
    public function setPath(string $path): void
36
    {
37
        $this->path = $path;
38
    }
39
40
    /**
41
     * Get path.
42
     *
43
     * @return string Path on which to be redirected.
44
     */
45
    public function getPath(): string
46
    {
47
        return $this->path;
48
    }
49
}
50