@@ -214,6 +214,9 @@ discard block |
||
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | + /** |
|
218 | + * @param string $service |
|
219 | + */ |
|
217 | 220 | public function setService($service, $class) |
218 | 221 | { |
219 | 222 | if($this->services === null) { |
@@ -225,6 +228,7 @@ discard block |
||
225 | 228 | |
226 | 229 | /** |
227 | 230 | * @param mixed string with reference to config |
231 | + * @param string $config |
|
228 | 232 | * @return mixed bool or config values |
229 | 233 | */ |
230 | 234 | public function getConfiguration($config = null) |
@@ -342,7 +346,6 @@ discard block |
||
342 | 346 | * Attach (or remove) multiple callbacks to an event and trigger those callbacks when that event is called. |
343 | 347 | * |
344 | 348 | * @param string $event name |
345 | - * @param mixed $value the optional value to pass to each callback |
|
346 | 349 | * @param mixed $callback the method or function to call - FALSE to remove all callbacks for event |
347 | 350 | */ |
348 | 351 | |
@@ -356,6 +359,9 @@ discard block |
||
356 | 359 | } |
357 | 360 | } |
358 | 361 | |
362 | + /** |
|
363 | + * @param string $event |
|
364 | + */ |
|
359 | 365 | public function callEvent($event, $method = false, $arguments = []) |
360 | 366 | { |
361 | 367 | if (isset(self::$events[$event])) { |
@@ -231,9 +231,9 @@ |
||
231 | 231 | public function getConfiguration($config = null) |
232 | 232 | { |
233 | 233 | if ($config !== null) { |
234 | - if (! empty($this->configuration->$config)) { |
|
234 | + if (!empty($this->configuration->$config)) { |
|
235 | 235 | return $this->configuration->$config; |
236 | - } elseif (! empty($this->files{$config})) { |
|
236 | + } elseif (!empty($this->files{$config})) { |
|
237 | 237 | $vars = include $this->files{$config}; |
238 | 238 | |
239 | 239 | if ($vars === false) { |
@@ -90,8 +90,6 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @access public |
92 | 92 | * |
93 | - * @param string $requestedView relative path for the view |
|
94 | - * @param string $renderName array of data to expose to view |
|
95 | 93 | * |
96 | 94 | * @throws \Exception when a view can not be found |
97 | 95 | */ |
@@ -181,6 +179,10 @@ discard block |
||
181 | 179 | * @return string processed content |
182 | 180 | */ |
183 | 181 | //@TODO: come back and clean up this and the way the view receives stuff |
182 | + |
|
183 | + /** |
|
184 | + * @param string|boolean $file |
|
185 | + */ |
|
184 | 186 | private function process($file) |
185 | 187 | { |
186 | 188 | ob_start(); |
@@ -129,11 +129,18 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | + /** |
|
133 | + * @param string $uri |
|
134 | + */ |
|
132 | 135 | private function isURIClean($uri, $uriChunks) |
133 | 136 | { |
134 | 137 | if (!preg_match("/^[a-z0-9:_\/\.\[\]-]+$/i", $uri) |
135 | 138 | || array_filter( |
136 | 139 | $uriChunks, |
140 | + |
|
141 | + /** |
|
142 | + * @param string $uriChunk |
|
143 | + */ |
|
137 | 144 | function ($uriChunk) { |
138 | 145 | if (strpos($uriChunk, '__') !== false) { |
139 | 146 | return true; |
@@ -148,6 +155,10 @@ discard block |
||
148 | 155 | } |
149 | 156 | |
150 | 157 | //@TODO add Security class. |
158 | + |
|
159 | + /** |
|
160 | + * @param string $data |
|
161 | + */ |
|
151 | 162 | private function normalize($data) |
152 | 163 | { |
153 | 164 | if (is_numeric($data)) { |
@@ -225,6 +236,9 @@ discard block |
||
225 | 236 | return $normalizedURI; |
226 | 237 | } |
227 | 238 | |
239 | + /** |
|
240 | + * @param string $uri |
|
241 | + */ |
|
228 | 242 | private function discoverRoute($uri) |
229 | 243 | { |
230 | 244 | $routes = $this->configuration->routes; |
@@ -259,6 +273,7 @@ discard block |
||
259 | 273 | * Normalize the $_SERVER vars for formatting the URI. |
260 | 274 | * |
261 | 275 | * @access public |
276 | + * @param string $uri |
|
262 | 277 | * @return string formatted/u/r/l |
263 | 278 | */ |
264 | 279 | private function uri($uri) |
@@ -312,6 +327,9 @@ discard block |
||
312 | 327 | return array_merge($return, array_values($uriChunks)); |
313 | 328 | } |
314 | 329 | |
330 | + /** |
|
331 | + * @param string $url |
|
332 | + */ |
|
315 | 333 | private function addQueryString($url, $key, $value) |
316 | 334 | { |
317 | 335 | $url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); |
@@ -323,6 +341,9 @@ discard block |
||
323 | 341 | } |
324 | 342 | } |
325 | 343 | |
344 | + /** |
|
345 | + * @param string $url |
|
346 | + */ |
|
326 | 347 | private function removeQueryString($url, $key) |
327 | 348 | { |
328 | 349 | $url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); |
@@ -394,7 +415,7 @@ discard block |
||
394 | 415 | * Set optional status header, and redirect to provided URL |
395 | 416 | * |
396 | 417 | * @access public |
397 | - * @return bool |
|
418 | + * @return false|null |
|
398 | 419 | */ |
399 | 420 | public function redirect($url = '/', $status = null) |
400 | 421 | { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | if (!preg_match("/^[a-z0-9:_\/\.\[\]-]+$/i", $uri) |
135 | 135 | || array_filter( |
136 | 136 | $uriChunks, |
137 | - function ($uriChunk) { |
|
137 | + function($uriChunk) { |
|
138 | 138 | if (strpos($uriChunk, '__') !== false) { |
139 | 139 | return true; |
140 | 140 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | $normalizedURI = ltrim(preg_replace('/\?.*/', '', $normalizedURI), '/'); |
220 | 220 | |
221 | - if (! empty($this->configuration->routes)) { |
|
221 | + if (!empty($this->configuration->routes)) { |
|
222 | 222 | $normalizedURI = $this->discoverRoute($normalizedURI); |
223 | 223 | } |
224 | 224 | |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | |
238 | 238 | $uri = $reroute; |
239 | 239 | |
240 | - if (! empty($params)) { |
|
240 | + if (!empty($params)) { |
|
241 | 241 | $pat = '/(\$\d+)/'; |
242 | 242 | $uri = preg_replace_callback( |
243 | 243 | $pat, |
244 | - function () use (&$params) { |
|
244 | + function() use (&$params) { |
|
245 | 245 | $first = $params[0]; |
246 | 246 | array_shift($params); |
247 | 247 | return $first; |