1 | <?php |
||
43 | abstract class RequestAbstract |
||
44 | { |
||
45 | const OS_LINUX = 'linux'; |
||
46 | const OS_WINDOWS = 'windows'; |
||
47 | const OS_UNKNOWN = 'unknown'; |
||
48 | |||
49 | /** |
||
50 | * @access protected |
||
51 | * @var string |
||
52 | */ |
||
53 | protected $_route; |
||
54 | |||
55 | /** |
||
56 | * @access protected |
||
57 | * @var array |
||
58 | */ |
||
59 | protected $_params = array(); |
||
60 | |||
61 | /** |
||
62 | * @access protected |
||
63 | * @var array |
||
64 | */ |
||
65 | protected $_routeParams = array(); |
||
66 | |||
67 | /** |
||
68 | * @access protected |
||
69 | * @var string |
||
70 | */ |
||
71 | protected $_base; |
||
72 | |||
73 | /** |
||
74 | * @access protected |
||
75 | * @var string |
||
76 | */ |
||
77 | protected $_locale; |
||
78 | |||
79 | /** |
||
80 | * @access protected |
||
81 | * @var string |
||
82 | */ |
||
83 | protected $_operatingSystem; |
||
84 | |||
85 | /** |
||
86 | * @access protected |
||
87 | * @var array |
||
88 | */ |
||
89 | protected $_data = array(); |
||
90 | |||
91 | /** |
||
92 | * Constructs the object |
||
93 | * |
||
94 | * @access public |
||
95 | * @param string $route |
||
96 | * @param array params |
||
97 | * @param string $base |
||
98 | * @param string $locale |
||
99 | * @param string $operatingSystem |
||
100 | * @param array $data |
||
101 | */ |
||
102 | public function __construct($route, $params, $base, $locale, $operatingSystem, $data = array()) |
||
121 | |||
122 | /** |
||
123 | * Returns the route of the request. |
||
124 | * |
||
125 | * @access public |
||
126 | * @return string |
||
127 | */ |
||
128 | public function getRoute() |
||
132 | |||
133 | /** |
||
134 | * Sets the route of the request |
||
135 | * |
||
136 | * @access public |
||
137 | * @param string $route |
||
138 | */ |
||
139 | public function setRoute($route) |
||
143 | |||
144 | /** |
||
145 | * Returns true if the given param key exists. |
||
146 | * |
||
147 | * @access public |
||
148 | * @param string $key |
||
149 | * @return string |
||
150 | */ |
||
151 | public function hasParam($key) |
||
155 | |||
156 | /** |
||
157 | * Returns the value for the given param key. If the |
||
158 | * key does not exists the function will return false. |
||
159 | * |
||
160 | * @access public |
||
161 | * @param string $key |
||
162 | * @return mixed |
||
163 | */ |
||
164 | public function getParam($key) |
||
172 | |||
173 | /** |
||
174 | * Returns all params of the request |
||
175 | * |
||
176 | * @access public |
||
177 | * @return array |
||
178 | */ |
||
179 | public function getParams() |
||
183 | |||
184 | /** |
||
185 | * Adds an parameter which is detected in the route. |
||
186 | * |
||
187 | * @access public |
||
188 | * @param mixed $param |
||
189 | */ |
||
190 | public function addRouteParam($param) |
||
194 | |||
195 | /** |
||
196 | * Sets the array of route params for the request |
||
197 | * |
||
198 | * @access public |
||
199 | * @param array $params |
||
200 | * @return boolean |
||
201 | */ |
||
202 | public function setRouteParams($params) |
||
212 | |||
213 | /** |
||
214 | * Returns the route param for the given index. |
||
215 | * |
||
216 | * @access public |
||
217 | * @param integer $index |
||
218 | * @return string|boolean |
||
219 | */ |
||
220 | public function getRouteParam($index) |
||
228 | |||
229 | /** |
||
230 | * Returns the delimitier, which is used to split the route |
||
231 | * into parts. |
||
232 | * |
||
233 | * @access public |
||
234 | * @return string |
||
235 | */ |
||
236 | abstract public function getRouteDelimiter(); |
||
237 | |||
238 | /** |
||
239 | * Returns the correct url for the given url part |
||
240 | * |
||
241 | * @access public |
||
242 | * @param string $routePart |
||
243 | * @return string |
||
244 | */ |
||
245 | public function getFullRoute($routePart = '') |
||
263 | |||
264 | /** |
||
265 | * Returns the locale of the request |
||
266 | * |
||
267 | * @access public |
||
268 | * @return string |
||
269 | */ |
||
270 | public function getLocale() |
||
274 | |||
275 | /** |
||
276 | * Returns the operating system of the machine |
||
277 | * |
||
278 | * @access public |
||
279 | * @return string |
||
280 | */ |
||
281 | public function getOperatingSystem() |
||
285 | } |
||
286 |