protected function filterNullVariable($haystack)
{
foreach ($haystack as $key => $value) {
if (is_array($value)) {
$haystack[$key] = $this->filterNullVariable($haystack[$key]);
} elseif (is_object($value)) {
$haystack[$key] = $this->filterNullVariable(get_class_vars(get_class($value)));
}
if (is_null($haystack[$key]) || empty($haystack[$key])) {
unset($haystack[$key]);
}
}
return $haystack;
}