Passed
Push — master ( a9f89d...4aed4d )
by Maxime
02:01
created

Route::getPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Piface\Router;
4
5
/**
6
 * Represent a register route.
7
 */
8
class Route
9
{
10
    /**
11
     * @var string
12
     */
13
    private $method;
14
15
    /**
16
     * @var string
17
     */
18
    private $name;
19
20
    /**
21
     * @var callable|string
22
     */
23
    private $action;
24
25
    /**
26
     * @var string
27
     */
28
    private $path;
29
30
    /**
31
     * @var array
32
     */
33
    private $parameters = [];
34
35
    /**
36
     * @var array
37
     */
38
    private $wheres = [];
39
40
    public function __construct(string $method, string $path, string $name, $action)
41
    {
42
        $this->name = $name;
43
        $this->action = $action;
44
        $this->path = $path;
45
        $this->method = $method;
46
    }
47
48
    public function getPath(): string
49
    {
50
        return $this->path;
51
    }
52
53
    public function getName(): string
54
    {
55
        return $this->name;
56
    }
57
58
    /**
59
     * @return callable|string
60
     */
61
    public function getAction()
62
    {
63
        return $this->action;
64
    }
65
66
    public function getParameters(): array
67
    {
68
        return $this->parameters;
69
    }
70
71
    public function setParameters(array $parameters): void
72
    {
73
        $this->parameters = array_merge($this->parameters, $parameters);
74
    }
75
76
    public function where(array $expressions)
77
    {
78
        $this->wheres = array_merge($this->wheres, $expressions);
79
80
        return $this;
81
    }
82
83
    public function getWhere(): array
84
    {
85
        return $this->wheres;
86
    }
87
88
    public function getMethod(): string
89
    {
90
        return $this->method;
91
    }
92
93
    public function setMethods(string $method): void
94
    {
95
        $this->method = $method;
96
    }
97
}
98