You are here

public function CurrentTime::evaluate in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Condition/CurrentTime.php \Drupal\rng\Plugin\Condition\CurrentTime::evaluate()
  2. 3.x src/Plugin/Condition/CurrentTime.php \Drupal\rng\Plugin\Condition\CurrentTime::evaluate()

Evaluates the condition and returns TRUE or FALSE accordingly.

Return value

bool TRUE if the condition has been met, FALSE otherwise.

Overrides ConditionInterface::evaluate

File

src/Plugin/Condition/CurrentTime.php, line 116

Class

CurrentTime
Evaluates if the current date is before or after the the configured date.

Namespace

Drupal\rng\Plugin\Condition

Code

public function evaluate() {
  $date = $this
    ->getDate();
  if ($date && is_numeric($date)) {
    if (!$this
      ->isNegated()) {
      return time() > $date;
    }
    else {
      return time() < $date;
    }
  }
  return FALSE;
}