Some optimizations & polishing following PR #3381
diff --git a/system/core/Input.php b/system/core/Input.php
index 11b2e94..d1353e9 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -156,8 +156,13 @@
*/
protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = NULL)
{
+ is_bool($xss_clean) OR $xss_clean = $this->_enable_xss;
+
// If $index is NULL, it means that the whole $array is requested
- if ($index === NULL)
+ isset($index) OR $index = array_keys($array);
+
+ // allow fetching multiple keys at once
+ if (is_array($index))
{
$output = array();
foreach (array_keys($array) as $key)
@@ -168,20 +173,6 @@
return $output;
}
- // allow fetching multiple keys at once
- if (is_array($index))
- {
- $output = array();
- foreach ($index as $var)
- {
- $output[$var] = $this->_fetch_from_array($array, $var, $xss_clean);
- }
-
- return $output;
- }
-
- is_bool($xss_clean) OR $xss_clean = $this->_enable_xss;
-
if (isset($array[$index]))
{
$value = $array[$index];