@@ -203,55 +203,65 @@ public function documentRoot() {
203203 * Returns server variables.
204204 *
205205 * @param string|null $key The key to get. Default: null - all variables.
206+ * @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null.
207+ * @param bool $nullIfEmpty Check the value with the empty() function. If empty() returns true, the function returns $default.
206208 *
207209 * @return array|string
208210 */
209- public function server ($ key = null ) {
210- return InternalHelper::getSingleKeyOrAll ($ this ->serverVariables , $ key );
211+ public function server ($ key = null , $ default = null , $ nullIfEmpty = false ) {
212+ return InternalHelper::getSingleKeyOrAll ($ this ->serverVariables , $ key, $ default , $ nullIfEmpty );
211213 }
212214
213215 /**
214216 * Returns cookies.
215217 *
216218 * @param string|null $key The cookie name to get. Default: null - all cookies.
219+ * @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null.
220+ * @param bool $nullIfEmpty Check the value with the empty() function. If empty() returns true, the function returns $default.
217221 *
218222 * @return array|string
219223 */
220- public function cookies ($ key = null ) {
221- return InternalHelper::getSingleKeyOrAll ($ this ->cookies , $ key );
224+ public function cookies ($ key = null , $ default = null , $ nullIfEmpty = false ) {
225+ return InternalHelper::getSingleKeyOrAll ($ this ->cookies , $ key, $ default , $ nullIfEmpty );
222226 }
223227
224228 /**
225229 * Returns GET data.
226230 *
227231 * @param string|null $key The key to get. Default: null - all keys.
232+ * @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null.
233+ * @param bool $nullIfEmpty Check the value with the empty() function. If empty() returns true, the function returns $default.
228234 *
229235 * @return array|mixed
230236 */
231- public function get ($ key = null ) {
232- return InternalHelper::getSingleKeyOrAll ($ this ->get , $ key );
237+ public function get ($ key = null , $ default = null , $ nullIfEmpty = false ) {
238+ return InternalHelper::getSingleKeyOrAll ($ this ->get , $ key, $ default , $ nullIfEmpty );
233239 }
234240
235241 /**
236242 * Returns POST data.
237243 *
238244 * @param string|null $key The key to get. Default: null - all keys.
245+ * @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null.
246+ * @param bool $nullIfEmpty Check the value with the empty() function. If empty() returns true, the function returns $default.
239247 *
240248 * @return array|mixed
241249 */
242- public function post ($ key = null ) {
243- return InternalHelper::getSingleKeyOrAll ($ this ->post , $ key );
250+ public function post ($ key = null , $ default = null , $ nullIfEmpty = false ) {
251+ return InternalHelper::getSingleKeyOrAll ($ this ->post , $ key, $ default , $ nullIfEmpty );
244252 }
245253
246254 /**
247255 * Returns posted files.
248256 *
249257 * @param string|null $key The key to get. Default: null - all keys.
258+ * @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null.
259+ * @param bool $nullIfEmpty Check the value with the empty() function. If empty() returns true, the function returns $default.
250260 *
251261 * @return array|mixed
252262 */
253- public function files ($ key = null ) {
254- return InternalHelper::getSingleKeyOrAll ($ this ->files , $ key );
263+ public function files ($ key = null , $ default = null , $ nullIfEmpty = false ) {
264+ return InternalHelper::getSingleKeyOrAll ($ this ->files , $ key, $ default , $ nullIfEmpty );
255265 }
256266
257267 /**
@@ -351,10 +361,12 @@ public function contentType() {
351361 * Returns HTTP headers of the request.
352362 *
353363 * @param string|null $key The key to get. Default: null - all keys.
364+ * @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null.
365+ * @param bool $nullIfEmpty Check the value with the empty() function. If empty() returns true, the function returns $default.
354366 *
355367 * @return array|string
356368 */
357- public function headers ($ key = null ) {
369+ public function headers ($ key = null , $ default = null , $ nullIfEmpty = false ) {
358370 if ($ this ->headers === null ) {
359371 $ result = array ();
360372
@@ -370,7 +382,7 @@ public function headers($key = null) {
370382 $ this ->headers = $ result ;
371383 }
372384
373- return InternalHelper::getSingleKeyOrAll ($ this ->headers , $ key );
385+ return InternalHelper::getSingleKeyOrAll ($ this ->headers , $ key, $ default , $ nullIfEmpty );
374386 }
375387
376388}
0 commit comments