original_string: protected function compute_next_start_time($numprevattempts, $lastattempt) {
          if ($numprevattempts == 0) {
              return 0;
          }
  
          $lastattemptfinish = $lastattempt->timefinish;
          if ($this->quiz->timelimit > 0) {
              $lastattemptfinish = min($lastattemptfinish,
                      $lastattempt->timestart + $this->quiz->timelimit);
          }
  
          if ($numprevattempts == 1 && $this->quiz->delay1) {
              return $lastattemptfinish + $this->quiz->delay1;
          } else if ($numprevattempts > 1 && $this->quiz->delay2) {
              return $lastattemptfinish + $this->quiz->delay2;
          }
          return 0;
      }
code: protected function compute_next_start_time($numprevattempts, $lastattempt) {
          if ($numprevattempts == 0) {
              return 0;
          }
  
          $lastattemptfinish = $lastattempt->timefinish;
          if ($this->quiz->timelimit > 0) {
              $lastattemptfinish = min($lastattemptfinish,
                      $lastattempt->timestart + $this->quiz->timelimit);
          }
  
          if ($numprevattempts == 1 && $this->quiz->delay1) {
              return $lastattemptfinish + $this->quiz->delay1;
          } else if ($numprevattempts > 1 && $this->quiz->delay2) {
              return $lastattemptfinish + $this->quiz->delay2;
          }
          return 0;
      }
code_tokens: protected function compute_next_start_time ( $ numprevattempts , $ lastattempt ) { if ( $ numprevattempts == 0 ) { return 0 ; } $ lastattemptfinish = $ lastattempt -> timefinish ; if ( $ this -> quiz -> timelimit > 0 ) { $ lastattemptfinish = min ( $ lastattemptfinish , $ lastattempt -> timestart + $ this -> quiz -> timelimit ) ; } if ( $ numprevattempts == 1 && $ this -> quiz -> delay1 ) { return $ lastattemptfinish + $ this -> quiz -> delay1 ; } else if ( $ numprevattempts > 1 && $ this -> quiz -> delay2 ) { return $ lastattemptfinish + $ this -> quiz -> delay2 ; } return 0 ; }
docstring: Compute the next time a student would be allowed to start an attempt,
  according to this rule.
  @param int $numprevattempts number of previous attempts.
  @param object $lastattempt information about the previous attempt.
  @return number the time.
docstring_tokens: Compute the next time a student would be allowed to start an attempt according to this rule .