Completed
Push — master ( b9be26...c0baca )
by Bohuslav
02:07
created

Route::getParsed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Kambo\Router\Route;
3
4
/**
5
 * Class representing the Route
6
 *
7
 * @author   Bohuslav Simek <[email protected]>
8
 * @license  Apache-2.0
9
 * @package  Kambo\Router\Route
10
 */
11
class Route
12
{
13
    private $method  = null;
14
    private $handler = null;
15
    private $url     = null;
16
17
    /**
18
     * Route constructor
19
     *
20
     * @param String $method
21
     * @param String $url
22
     * @param Mixed  $handler
23
     */
24 28
    public function __construct($method, $url, $handler)
25
    {
26 28
        $this->method  = $method;
27 28
        $this->handler = $handler;
28 28
        $this->url     = $url;
29 28
    }
30
31
    /**
32
     * Sets route method
33
     *
34
     * @param string $method route method
35
     *
36
     * @return self for fluent interface
37
     */
38 1
    public function setMethod($method)
39
    {
40 1
        $this->method = $method;
41
42 1
        return $this;
43
    }
44
45
    /**
46
     * Get route method
47
     *
48
     * @return string
49
     */
50 24
    public function getMethod()
51
    {
52 24
        return $this->method;
53
    }
54
55
    /**
56
     * Sets URL for route
57
     *
58
     * @param mixed $url route url
59
     *
60
     * @return self for fluent interface
61
     */
62 1
    public function setUrl($url)
63
    {
64 1
        $this->url = $url;
65
66 1
        return $this;
67
    }
68
69
    /**
70
     * Get URL of route
71
     *
72
     * @return string
73
     */
74 26
    public function getUrl()
75
    {
76 26
        return $this->url;
77
    }
78
79
    /**
80
     * Sets handler that will be executed if the url will match the route.
81
     *
82
     * @param mixed $handler handler which will be executed if the url will
83
     *                       match the route
84
     *
85
     * @return self for fluent interface
86
     */
87 1
    public function setHandler($handler)
88
    {
89 1
        $this->handler = $handler;
90
91 1
        return $this;
92
    }
93
94
    /**
95
     * Get handler
96
     *
97
     * @return mixed
98
     */
99 22
    public function getHandler()
100
    {
101 22
        return $this->handler;
102
    }
103
}
104