@@ -111,29 +111,6 @@ public static function input(bool $safeData = true)
111111 return $ safeData ? \Leaf \Anchor::sanitize ($ data ) : $ data ;
112112 }
113113
114- /**
115- * Fetch GET and POST data
116- *
117- * This method returns a union of GET and POST data as a key-value array, or the value
118- * of the array key if requested. If the array key does not exist, NULL is returned,
119- * unless there is a default value specified.
120- *
121- * @param string|null $key
122- * @param mixed|null $default
123- *
124- * @return mixed
125- */
126- public static function params (string $ key = null , $ default = null )
127- {
128- $ union = static ::body ();
129-
130- if ($ key ) {
131- return $ union [$ key ] ?? $ default ;
132- }
133-
134- return $ union ;
135- }
136-
137114 /**
138115 * Attempt to retrieve data from the request.
139116 *
@@ -187,6 +164,17 @@ public static function urlData($item = null, $default = null)
187164 return \Leaf \Anchor::deepGet ($ _GET , $ item ) ?? $ default ;
188165 }
189166
167+ /**
168+ * Return only get request data
169+ *
170+ * @param string|array $item The items to output
171+ * @param mixed $default The default value to return if no data is available
172+ */
173+ public static function query ($ item = null , $ default = null )
174+ {
175+ return \Leaf \Anchor::deepGet ($ _GET , $ item ) ?? $ default ;
176+ }
177+
190178 /**
191179 * Return only get request data
192180 *
@@ -201,8 +189,7 @@ public static function postData($item = null, $default = null)
201189 /**
202190 * Returns request data
203191 *
204- * This method returns data passed into the request (request or form data).
205- * This method returns get, post, put patch, delete or raw faw form data or NULL
192+ * This method returns get, post, put patch, delete or raw form data or NULL
206193 * if the data isn't found.
207194 *
208195 * @param array|string $params The parameter(s) to return
@@ -223,6 +210,38 @@ public static function get($params, bool $safeData = true)
223210 return $ data ;
224211 }
225212
213+ /**
214+ * Returns request data
215+ *
216+ * This method returns get, post, put patch, delete or raw form data or NULL
217+ * if the data isn't found.
218+ *
219+ * @param string|null $key
220+ * @param mixed|null $default
221+ *
222+ * @return mixed
223+ */
224+ public static function params (string $ key = null , $ default = null )
225+ {
226+ return static ::get ($ key ) ?? $ default ;
227+ }
228+
229+ /**
230+ * Returns request data
231+ *
232+ * This method returns get, post, put patch, delete or raw form data or NULL
233+ * if the data isn't found.
234+ *
235+ * @param string|null $key
236+ * @param mixed|null $default
237+ *
238+ * @return mixed
239+ */
240+ public static function getOrDefault (string $ key = null , $ default = null )
241+ {
242+ return static ::get ($ key ) ?? $ default ;
243+ }
244+
226245 /**
227246 * Get all the request data as an associative array
228247 *
0 commit comments