You are here

protected function StatusReportController::getLastUpdatedTime in Acquia Content Hub 8.2

Determines most recent updated time.

Parameters

array $metrics: Current client metrics.

Return value

string Last updated time in 'time ago' format.

Throws

\Exception

1 call to StatusReportController::getLastUpdatedTime()
StatusReportController::getWebhooksPageSection in modules/acquia_contenthub_publisher/src/Controller/StatusReportController.php
Returns the Webhooks page section.

File

modules/acquia_contenthub_publisher/src/Controller/StatusReportController.php, line 423

Class

StatusReportController
Controller for Status Reports.

Namespace

Drupal\acquia_contenthub_publisher\Controller

Code

protected function getLastUpdatedTime(array $metrics) {
  if (!isset($metrics['publisher']['last_updated']) && !isset($metrics['subscriber']['last_updated'])) {
    return 'Not Found';
  }
  $times = [];
  $times['publisher_updated'] = $metrics['publisher']['last_updated'] ?? 0;
  $times['subscriber_updated'] = $metrics['subscriber']['last_updated'] ?? 0;
  $times = array_filter($times);
  return $this
    ->getTimeAgo(max($times));
}