You are here

public static function DataService::finishBatch in Weather 8

Same name and namespace in other branches
  1. 2.0.x src/Service/DataService.php \Drupal\weather\Service\DataService::finishBatch()

Batch finish callback.

File

src/Service/DataService.php, line 184

Class

DataService
DataService service.

Namespace

Drupal\weather\Service

Code

public static function finishBatch($success, $results, $operations) {
  $messenger = \Drupal::messenger();
  if ($success) {
    $messenger
      ->addMessage(t('@count items processed.', [
      '@count' => count($results),
    ]));
  }
  else {
    $error_operation = reset($operations);
    $messenger
      ->addMessage(t('An error occurred while processing @operation with arguments : @args', [
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    ]));
  }
}