Ejemplo n.º 1
0
 protected function _parseQueryParams(array $params = array(), $reset = false)
 {
     if (!$reset && isset($this->req)) {
         $params = \Coast\array_merge_smart($this->req->queryParams(), $params);
     }
     return \Coast\array_filter_null_recursive($params);
 }
Ejemplo n.º 2
0
/**
 * Recursively remove null values from array.
 * @param  array $array
 * @return array
 */
function array_filter_null_recursive($array)
{
    $output = [];
    foreach ($array as $key => $value) {
        if (\is_array($value)) {
            $value = \Coast\array_filter_null_recursive($value);
            if (\count($value) > 0) {
                $output[$key] = $value;
            }
        } elseif (isset($value)) {
            $output[$key] = $value;
        }
    }
    return $output;
}