You are here

private function SplashifyInjection::checkFrequency in Splashify 8.2

Checks can we display splash again from the group.

Parameters

$splash:

Return value

bool

1 call to SplashifyInjection::checkFrequency()
SplashifyInjection::findSplash in src/Service/SplashifyInjection.php
Choosing an entity which will be displayed.

File

src/Service/SplashifyInjection.php, line 297

Class

SplashifyInjection
Class SplashifyInjection.

Namespace

Drupal\splashify\Service

Code

private function checkFrequency($splash) {
  $frequency = $splash
    ->getGroup()
    ->getOften();
  if ($frequency == 'never') {
    return FALSE;
  }
  $cookie = \Drupal::request()->cookies;
  $splashify_cookies = $cookie
    ->get('splashify');
  if (!is_array($splashify_cookies) || !array_key_exists($splash
    ->id(), $splashify_cookies)) {
    return TRUE;
  }
  $expired_time = REQUEST_TIME - $splashify_cookies[$splash
    ->id()];
  return $expired_time >= $this->timeLine[$frequency];
}