You are here

protected function LogsHttpLogger::arrayRemoveEmpty in Logs HTTP 8

Deep array filter; Remove empty values.

Parameters

array $haystack: The variable to filter.

Return value

array The filtered array.

1 call to LogsHttpLogger::arrayRemoveEmpty()
LogsHttpLogger::addEventToCache in src/Logger/LogsHttpLogger.php
Add an event to static cache.

File

src/Logger/LogsHttpLogger.php, line 160

Class

LogsHttpLogger
Implements a Logs Http Logger instance.

Namespace

Drupal\logs_http\Logger

Code

protected function arrayRemoveEmpty(array $haystack) {
  foreach ($haystack as $key => $value) {
    if (is_array($value)) {
      $haystack[$key] = $this
        ->arrayRemoveEmpty($haystack[$key]);
    }
    if (empty($haystack[$key])) {
      unset($haystack[$key]);
    }
  }
  return $haystack;
}