You are here

public function UpdateHelper::lastRun in Evercurrent 8.2

Same name and namespace in other branches
  1. 8 src/UpdateHelper.php \Drupal\evercurrent\UpdateHelper::lastRun()

Get interval since last try.

Return value

string The interval since the last try.

File

src/UpdateHelper.php, line 297

Class

UpdateHelper
Default UpdateHelper instantiation.

Namespace

Drupal\evercurrent

Code

public function lastRun() {
  $last = \Drupal::state()
    ->get('evercurrent_last_run') ?: 0;
  if ($last > 0) {
    $last_time = \Drupal::service('date.formatter')
      ->formatInterval(time() - $last);
  }
  else {
    $last_time = t('Never.');
  }
  return t('%last_time', [
    '%last_time' => $last_time,
  ]);
}