public static function isRecursivelyEmpty($data) { if (is_object($data)) { foreach ($data as $property) { if (!static::isRecursivelyEmpty($property)) { return false; } } return true; } else { if (is_array($data)) { if (!empty($data)) { foreach ($data as $entry) { if (!static::isRecursivelyEmpty($entry)) { return false; } } return true; } return true; } } return empty($data); }