You are here

abstract class BatchProcessorBase in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Base/BatchProcessorBase.php \Drupal\content_synchronizer\Base\BatchProcessorBase
  2. 3.x src/Base/BatchProcessorBase.php \Drupal\content_synchronizer\Base\BatchProcessorBase

Batch Processor base.

Hierarchy

Expanded class hierarchy of BatchProcessorBase

2 files declare their use of BatchProcessorBase
BatchExportProcessor.php in src/Processors/BatchExportProcessor.php
BatchImportProcessor.php in src/Processors/BatchImportProcessor.php

File

src/Base/BatchProcessorBase.php, line 8

Namespace

Drupal\content_synchronizer\Base
View source
abstract class BatchProcessorBase {

  /**
   * Callback method.
   */
  public static abstract function onFinishBatchProcess($success, $results, $operations);

  /**
   * Operation callback.
   */
  public static abstract function processBatchOperation(array $oprationData, array $context);

  /**
   * Call the callback method if defined.
   */
  protected static function callFinishCallback($finishCallback = NULL, $data = NULL) {
    if (is_array($finishCallback)) {
      list($object, $method) = $finishCallback;
      if (method_exists($object, $method)) {
        if ($data) {
          $object
            ->{$method}($data);
        }
        else {
          $object
            ->{$method}();
        }
      }
    }
    elseif (is_string($finishCallback)) {
      if (function_exists($finishCallback)) {
        if ($data) {
          $finishCallback($data);
        }
        else {
          $finishCallback();
        }
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BatchProcessorBase::callFinishCallback protected static function Call the callback method if defined.
BatchProcessorBase::onFinishBatchProcess abstract public static function Callback method. 2
BatchProcessorBase::processBatchOperation abstract public static function Operation callback. 2