private function cleanOutput($output) {
    if (!is_array($output)) {
      $output = explode(PHP_EOL, $output);
    }

    // Datetime weirdness. Apparently this is caused by theming issues on the
    // remote theme. Why it is being called when executed via CLI is another
    // story.
    foreach ($output as $key => $value) {
      $invalid_strings = [
        'date_timezone_set() expects parameter',
        'date_format() expects parameter',
        'common.inc:20',
        'given common.inc:20',
        'Warning: Using a password on the command line interface can be insecure.',
      ];
      foreach ($invalid_strings as $invalid_string) {
        if (strpos($value, $invalid_string) === 0) {
          unset($output[$key]);
        }
      }
    }

    // Remove blank lines.
    $output = array_filter($output);

    // Ensure we are returning arrays with no key association.
    return array_values($output);
  }