/**
  * {@inheritDoc}
  */
 public function process(ScheduleInterface $schedule, \DateTime $currentDateTime = null)
 {
     // ensure that a schedule is not executed twice within in a minute
     $now = $currentDateTime == null ? new \DateTime() : $currentDateTime;
     if ($schedule->getScheduledAt() != null && $schedule->getScheduledAt()->format('Y-m-d H:i') == $now->format('Y-m-d H:i')) {
         return false;
     }
     $cron = $this->expressionFactory->create($schedule->getExpression());
     return $cron->isDue($currentDateTime);
 }
 /**
  * {@inheritDoc}
  */
 public function process(ScheduleInterface $schedule, \DateTime $currentDateTime = null)
 {
     $now = $currentDateTime == null ? new \DateTime() : $currentDateTime;
     if ($schedule->getScheduledAt() !== null) {
         return false;
     }
     if ($schedule->getExpression() < $now->getTimestamp()) {
         return true;
     }
     return false;
 }