-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRequest.php
76 lines (63 loc) · 1.5 KB
/
Request.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
class Request
{
protected $controllerName = null;
protected $actionName = null;
protected $params = array();
protected $isDispatched = null;
public function isPost()
{
return $_SERVER['REQUEST_METHOD'] === 'POST';
}
public function getUri()
{
return $_SERVER["REQUEST_URI"];
}
public function getControllerName()
{
return $this->controllerName;
}
public function setControllerName($value)
{
$this->controllerName = $value;
return $this;
}
public function getActionName()
{
return $this->actionName;
}
public function setActionName($value)
{
$this->actionName = $value;
return $this;
}
public function setDispatched($value)
{
$this->isDispatched = $value;
return $this;
}
public function getDispatched()
{
return $this->isDispatched;
}
public function getParam($paramName, $defaultValue = null)
{
if (isset($this->params[$paramName]))
return $this->params[$paramName];
return $defaultValue;
}
public function setParam($paramName, $value)
{
$this->params[$paramName] = $value;
return $this;
}
public function setAllParams($params)
{
$this->params = $params;
return $this;
}
public function getAllParams()
{
return $this->params;
}
}