You are here

protected static function BatchProcessorBase::callFinishCallback in Content Synchronizer 8

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

Call the callback method if defined.

2 calls to BatchProcessorBase::callFinishCallback()
BatchExportProcessor::onFinishBatchProcess in src/Processors/BatchExportProcessor.php
Callback method.
BatchImportProcessor::onFinishBatchProcess in src/Processors/BatchImportProcessor.php
Callback.

File

src/Base/BatchProcessorBase.php, line 23

Class

BatchProcessorBase
Batch Processor base.

Namespace

Drupal\content_synchronizer\Base

Code

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();
      }
    }
  }
}