modules/custom/d_p_subscribe_file/src/Controller/DownloadFile.php
private function checkLinkActive($entity) {
    $created = $entity->get('created')->get(0)->getValue();
    if (time() > $created['value'] + 86400) {
      $this->goHomeWithMessage(t('Link is not active, please add your email again'));
    }
  }
private function checkLinkActive($entity) {
    $created = $entity->get('created')->get(0)->getValue();
    if (time() > $created['value'] + 86400) {
      $this->goHomeWithMessage(t('Link is not active, please add your email again'));
    }
  }
Checking link was created before 24h.
@param $entity