@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Check if an response output buffering is active. |
117 | - * @return boolean |
|
117 | + * @return boolean|null |
|
118 | 118 | */ |
119 | 119 | public static function isBuffering(){ |
120 | 120 | return static::$buffer; |
@@ -139,7 +139,6 @@ discard block |
||
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Append a text to the buffer. |
142 | - * @param mixed $payload Text to append to the response buffer |
|
143 | 142 | */ |
144 | 143 | public static function text(...$args){ |
145 | 144 | static::type(static::TYPE_TEXT); |
@@ -148,7 +147,6 @@ discard block |
||
148 | 147 | |
149 | 148 | /** |
150 | 149 | * Append an XML string to the buffer. |
151 | - * @param mixed $payload Data to append to the response buffer |
|
152 | 150 | */ |
153 | 151 | public static function xml(...$args){ |
154 | 152 | static::type(static::TYPE_XML); |
@@ -157,7 +155,6 @@ discard block |
||
157 | 155 | |
158 | 156 | /** |
159 | 157 | * Append a SVG string to the buffer. |
160 | - * @param mixed $payload Data to append to the response buffer |
|
161 | 158 | */ |
162 | 159 | public static function svg(...$args){ |
163 | 160 | static::type(static::TYPE_SVG); |
@@ -166,7 +163,6 @@ discard block |
||
166 | 163 | |
167 | 164 | /** |
168 | 165 | * Append an HTML string to the buffer. |
169 | - * @param mixed $payload Data to append to the response buffer |
|
170 | 166 | */ |
171 | 167 | public static function html(...$args){ |
172 | 168 | static::type(static::TYPE_HTML); |
@@ -181,7 +177,6 @@ discard block |
||
181 | 177 | * - Objects, arrays and bools will be JSON encoded |
182 | 178 | * - Strings and numbers will be appendend to the response |
183 | 179 | * |
184 | - * @param mixed $payload Data to append to the response buffer |
|
185 | 180 | */ |
186 | 181 | public static function add(){ |
187 | 182 | foreach(func_get_args() as $data){ |
@@ -198,10 +193,16 @@ discard block |
||
198 | 193 | } |
199 | 194 | } |
200 | 195 | |
196 | + /** |
|
197 | + * @param integer $code |
|
198 | + */ |
|
201 | 199 | public static function status($code,$message=''){ |
202 | 200 | static::header('Status',$message?:$code,$code); |
203 | 201 | } |
204 | 202 | |
203 | + /** |
|
204 | + * @param string $name |
|
205 | + */ |
|
205 | 206 | public static function header($name,$value,$code=null){ |
206 | 207 | if (empty(static::$headers[$name])){ |
207 | 208 | static::$headers[$name] = [[$value,$code]]; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * Run one of the mapped callbacks to a passed HTTP Method. |
106 | 106 | * @param array $args The arguments to be passed to the callback |
107 | 107 | * @param string $method The HTTP Method requested. |
108 | - * @return array The callback response. |
|
108 | + * @return string[] The callback response. |
|
109 | 109 | */ |
110 | 110 | public function run(array $args, $method='get'){ |
111 | 111 | $method = strtolower($method); |
@@ -235,7 +235,6 @@ discard block |
||
235 | 235 | |
236 | 236 | /** |
237 | 237 | * Bind a middleware callback to invoked before the route definition |
238 | - * @param callable $before The callback to be invoked ($this is binded to the route object). |
|
239 | 238 | * @return Route |
240 | 239 | */ |
241 | 240 | public function & before($callback){ |
@@ -359,7 +358,7 @@ discard block |
||
359 | 358 | * Helper for reverse routing : obtain a complete URL for a named route with passed parameters |
360 | 359 | * @param string $name The name tag of the route. |
361 | 360 | * @param array $params The parameter map of the route dynamic values. |
362 | - * @return string |
|
361 | + * @return URL |
|
363 | 362 | */ |
364 | 363 | public static function URL($name, $params = []){ |
365 | 364 | return ($r = static::tagged($name)) ? $r-> getURL($params) : new URL(); |
@@ -389,7 +388,7 @@ discard block |
||
389 | 388 | * @param string $pattern The URL schema with the named parameters |
390 | 389 | * @param string $URL The URL to process, if omitted the current request URI will be used. |
391 | 390 | * @param boolean $cut If true don't limit the matching to the whole URL (used for group pattern extraction) |
392 | - * @return array The extracted variables |
|
391 | + * @return callable The extracted variables |
|
393 | 392 | */ |
394 | 393 | protected static function extractVariablesFromURL($pattern, $URL=null, $cut=false){ |
395 | 394 | $URL = $URL ?: Request::URI(); |
@@ -21,6 +21,9 @@ discard block |
||
21 | 21 | $last_info = null, |
22 | 22 | $proxy = null; // host:port |
23 | 23 | |
24 | + /** |
|
25 | + * @param string $method |
|
26 | + */ |
|
24 | 27 | protected static function request($method, $url, $data=[], array $headers=[], $data_as_json=false, $username=null, $password = null){ |
25 | 28 | $http_method = strtoupper($method); |
26 | 29 | $ch = curl_init($url); |
@@ -86,6 +89,9 @@ discard block |
||
86 | 89 | return $value===null ? static::$json_data : static::$json_data = $value; |
87 | 90 | } |
88 | 91 | |
92 | + /** |
|
93 | + * @param string $headers |
|
94 | + */ |
|
89 | 95 | protected static function trasformRawHeaders($headers) { |
90 | 96 | foreach (explode("\r\n", trim($headers)) as $line) { |
91 | 97 | if (empty($line)) continue; |