public function SendUsageData::processItem in Open Social 8.5
Same name and namespace in other branches
- 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()
- 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()
- 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()
- 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()
- 10.3.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()
- 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()
- 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()
- 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\QueueWorkerCode
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());
}