1 | <?php |
||
45 | class WebRequest extends RequestAbstract |
||
46 | { |
||
47 | /** |
||
48 | * @access protected |
||
49 | * @var boolean |
||
50 | */ |
||
51 | protected $_isSsl = false; |
||
52 | |||
53 | /** |
||
54 | * @access protected |
||
55 | * @var \Zepi\Turbo\FrameworkInterface\SessionInterface |
||
56 | */ |
||
57 | protected $_session = null; |
||
58 | |||
59 | /** |
||
60 | * Constructs the object |
||
61 | * |
||
62 | * @access public |
||
63 | * @param string $route |
||
64 | * @param array params |
||
65 | * @param string $base |
||
66 | * @param string $locale |
||
67 | * @param boolean $isSsl |
||
68 | * @param array $data |
||
69 | */ |
||
70 | public function __construct($route, $params, $base, $locale, $isSsl, $data = array()) |
||
76 | |||
77 | /** |
||
78 | * Returns the delimitier, which is used to split the route |
||
79 | * into parts. |
||
80 | * The delimiter for the html request is the slash (/). |
||
81 | * |
||
82 | * @access public |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getRouteDelimiter() |
||
89 | |||
90 | /** |
||
91 | * Saves the given value for the given key in the session data |
||
92 | * |
||
93 | * @access public |
||
94 | * @param string $key |
||
95 | * @param mixed $value |
||
96 | */ |
||
97 | public function setSessionData($key, $value) |
||
101 | |||
102 | /** |
||
103 | * Returns the session value of the given key. |
||
104 | * |
||
105 | * @access public |
||
106 | * @param string $key |
||
107 | * @return mixed |
||
108 | */ |
||
109 | public function getSessionData($key = '') |
||
117 | |||
118 | /** |
||
119 | * Deletes the value for the given key |
||
120 | * |
||
121 | * @access public |
||
122 | * @param string $key |
||
123 | * @return boolean |
||
124 | */ |
||
125 | public function deleteSessionData($key) |
||
134 | |||
135 | /** |
||
136 | * Removes all session data |
||
137 | * |
||
138 | * @access public |
||
139 | */ |
||
140 | public function clearSessionData() |
||
146 | |||
147 | /** |
||
148 | * Returns the cookie value of the given key. |
||
149 | * |
||
150 | * @access public |
||
151 | * @param string $key |
||
152 | * @return mixed |
||
153 | */ |
||
154 | public function getCookieData($key = '') |
||
162 | |||
163 | /** |
||
164 | * Returns true if this request was made over a |
||
165 | * secure connection trough ssl. |
||
166 | * |
||
167 | * @access public |
||
168 | * @return boolean |
||
169 | */ |
||
170 | public function isSsl() |
||
174 | |||
175 | /** |
||
176 | * Adds a session object to the request |
||
177 | * |
||
178 | * @access public |
||
179 | * @param \Zepi\Turbo\FrameworkInterface\SessionInterface $session |
||
180 | * @return boolean |
||
181 | */ |
||
182 | public function setSession(SessionInterface $session) |
||
192 | |||
193 | /** |
||
194 | * Returns true if a session for the given name |
||
195 | * exists. Otherwise returns false. |
||
196 | * |
||
197 | * @access public |
||
198 | * @return boolean |
||
199 | */ |
||
200 | public function hasSession() |
||
208 | |||
209 | /** |
||
210 | * Returns the session |
||
211 | * |
||
212 | * @access public |
||
213 | * @return false|\Zepi\Turbo\FrameworkInterface\SessionInterface |
||
214 | */ |
||
215 | public function getSession() |
||
223 | |||
224 | /** |
||
225 | * Removes the session |
||
226 | * |
||
227 | * @access public |
||
228 | */ |
||
229 | public function removeSession() |
||
234 | } |
||
235 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: