/** * Whether the test can be repeated again. * @return boolean */ public function canBeStarted() { if (!$this->course->deadlineNotReached()) { return false; } if ($this->result == Question::RESULT_UNKNOWN) { return true; } if ($this->result == Question::RESULT_INVALID) { if ($this->startedAt < time() - self::TIME_BETWEEN_TRIALS_SEC) { return true; } } return false; }