private function _toCleanArray(array $data)
    {
        switch (count($data)) {
            case 0:
                return null;

            case 1:
                if (isset($data[0])) {
                    // Return array content when only one item
                    // with the key 0.
                    if (is_array($data[0])) {
                        return $this->_toCleanArray($data[0]);
                    } else {
                        return $data[0];
                    }
                }
                break;

            case 2:
                if (isset($data[0], $data[1]) && is_string($data[1])) {
                    if (('info' === $data[1]) || ('warning' === $data[1]) || ('error' === $data[1])) {
                        if (is_array($data[0])) {
                            return $this->_toCleanArray($data[0]);
                        } else {
                            return $data[0];
                        }
                    }
                }
        }
        $output = array();
        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $output[$key] = $this->_toCleanArray($value);
            } else {
                if (is_string($value)) {
                    // Filter passwords from the log
                    if (\MUtil_String::contains($key, 'password', true) || \MUtil_String::contains($key, 'pwd', true)) {
                        $value = '****';
                    }
                } elseif ($value instanceof Zend_Date) {
                    // Output iso representation for date objects
                    $value = $value->getIso();
                }
                $output[$key] = $value;
            }
        }

        return $output;
    }