You are here

public function SendUsageData::processItem in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/QueueWorker/SendUsageData.php \Drupal\social_lets_connect_usage\Plugin\QueueWorker\SendUsageData::processItem()
  2. 8.5 modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/QueueWorker/SendUsageData.php \Drupal\social_lets_connect_usage\Plugin\QueueWorker\SendUsageData::processItem()
  3. 8.6 modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/QueueWorker/SendUsageData.php \Drupal\social_lets_connect_usage\Plugin\QueueWorker\SendUsageData::processItem()
  4. 8.7 modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/QueueWorker/SendUsageData.php \Drupal\social_lets_connect_usage\Plugin\QueueWorker\SendUsageData::processItem()
  5. 8.8 modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/QueueWorker/SendUsageData.php \Drupal\social_lets_connect_usage\Plugin\QueueWorker\SendUsageData::processItem()
  6. 10.0.x modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/QueueWorker/SendUsageData.php \Drupal\social_lets_connect_usage\Plugin\QueueWorker\SendUsageData::processItem()
  7. 10.1.x modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/QueueWorker/SendUsageData.php \Drupal\social_lets_connect_usage\Plugin\QueueWorker\SendUsageData::processItem()
  8. 10.2.x modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/QueueWorker/SendUsageData.php \Drupal\social_lets_connect_usage\Plugin\QueueWorker\SendUsageData::processItem()

Will process a queue item.

$send_data['site_key'] = $site_key; $send_data['send_info'] = [ 'last_send' => $last_send, 'times_send' => $times_send, 'current_time' => $current_time, ]; $send_data['usage_data'] = array $usage_data;

Overrides QueueWorkerInterface::processItem

File

modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/QueueWorker/SendUsageData.php, line 77

Class

SendUsageData
Send usage data.

Namespace

Drupal\social_lets_connect_usage\Plugin\QueueWorker

Code

public function processItem($data) {
  $config = $this->config
    ->get('social_lets_connect_usage.settings');
  $usage_data_url = $config
    ->get('url');
  try {
    $response = $this->client
      ->post($usage_data_url, [
      'json' => $data,
    ]);
  } catch (RequestException $e) {
    return FALSE;
  }
  return Json::decode($response
    ->getBody()
    ->getContents());
}