@@ -97,37 +97,33 @@ public function getUrl()
9797 * Returns variable provided to the script via URL query ($_GET).
9898 * If no key is passed, returns the entire array.
9999 * @param string key
100- * @param mixed default value
101100 * @return mixed
102101 */
103- public function getQuery ($ key = NULL , $ default = NULL )
102+ public function getQuery ($ key = NULL )
104103 {
105104 if (func_num_args () === 0 ) {
106105 return $ this ->url ->getQueryParameters ();
107- } else {
108- return $ this -> url -> getQueryParameter ( $ key , $ default );
106+ } elseif ( func_num_args () > 1 ) {
107+ trigger_error ( __METHOD__ . ' () parameter $default is deprecated, use operator ?? ' , E_USER_DEPRECATED );
109108 }
109+ return $ this ->url ->getQueryParameter ($ key );
110110 }
111111
112112
113113 /**
114114 * Returns variable provided to the script via POST method ($_POST).
115115 * If no key is passed, returns the entire array.
116116 * @param string key
117- * @param mixed default value
118117 * @return mixed
119118 */
120- public function getPost ($ key = NULL , $ default = NULL )
119+ public function getPost ($ key = NULL )
121120 {
122121 if (func_num_args () === 0 ) {
123122 return $ this ->post ;
124-
125- } elseif (isset ($ this ->post [$ key ])) {
126- return $ this ->post [$ key ];
127-
128- } else {
129- return $ default ;
123+ } elseif (func_num_args () > 1 ) {
124+ trigger_error (__METHOD__ . '() parameter $default is deprecated, use operator ?? ' , E_USER_DEPRECATED );
130125 }
126+ return $ this ->post [$ key ] ?? NULL ;
131127 }
132128
133129
@@ -155,12 +151,14 @@ public function getFiles()
155151 /**
156152 * Returns variable provided to the script via HTTP cookies.
157153 * @param string key
158- * @param mixed default value
159154 * @return mixed
160155 */
161- public function getCookie ($ key, $ default = NULL )
156+ public function getCookie ($ key )
162157 {
163- return $ this ->cookies [$ key ] ?? $ default ;
158+ if (func_num_args () > 1 ) {
159+ trigger_error (__METHOD__ . '() parameter $default is deprecated, use operator ?? ' , E_USER_DEPRECATED );
160+ }
161+ return $ this ->cookies [$ key ] ?? NULL ;
164162 }
165163
166164
@@ -202,13 +200,15 @@ public function isMethod($method)
202200 * Return the value of the HTTP header. Pass the header name as the
203201 * plain, HTTP-specified header name (e.g. 'Accept-Encoding').
204202 * @param string
205- * @param string|NULL
206203 * @return string|NULL
207204 */
208- public function getHeader ($ header, $ default = NULL )
205+ public function getHeader ($ header )
209206 {
207+ if (func_num_args () > 1 ) {
208+ trigger_error (__METHOD__ . '() parameter $default is deprecated, use operator ?? ' , E_USER_DEPRECATED );
209+ }
210210 $ header = strtolower ($ header );
211- return $ this ->headers [$ header ] ?? $ default ;
211+ return $ this ->headers [$ header ] ?? NULL ;
212212 }
213213
214214
0 commit comments