original_string: public function process_save(question_attempt_pending_step $pendingstep) {
          if ($this->qa->get_state()->is_finished()) {
              return question_attempt::DISCARD;
          } else if (!$this->qa->get_state()->is_active()) {
              throw new coding_exception('Question is not active, cannot process_actions.');
          }
  
          if ($this->is_same_response($pendingstep)) {
              return question_attempt::DISCARD;
          }
  
          if ($this->is_complete_response($pendingstep)) {
              $pendingstep->set_state(question_state::$complete);
          } else {
              $pendingstep->set_state(question_state::$todo);
          }
          return question_attempt::KEEP;
      }
code: public function process_save(question_attempt_pending_step $pendingstep) {
          if ($this->qa->get_state()->is_finished()) {
              return question_attempt::DISCARD;
          } else if (!$this->qa->get_state()->is_active()) {
              throw new coding_exception('Question is not active, cannot process_actions.');
          }
  
          if ($this->is_same_response($pendingstep)) {
              return question_attempt::DISCARD;
          }
  
          if ($this->is_complete_response($pendingstep)) {
              $pendingstep->set_state(question_state::$complete);
          } else {
              $pendingstep->set_state(question_state::$todo);
          }
          return question_attempt::KEEP;
      }
code_tokens: public function process_save ( question_attempt_pending_step $ pendingstep ) { if ( $ this -> qa -> get_state ( ) -> is_finished ( ) ) { return question_attempt :: DISCARD ; } else if ( ! $ this -> qa -> get_state ( ) -> is_active ( ) ) { throw new coding_exception ( 'Question is not active, cannot process_actions.' ) ; } if ( $ this -> is_same_response ( $ pendingstep ) ) { return question_attempt :: DISCARD ; } if ( $ this -> is_complete_response ( $ pendingstep ) ) { $ pendingstep -> set_state ( question_state :: $ complete ) ; } else { $ pendingstep -> set_state ( question_state :: $ todo ) ; } return question_attempt :: KEEP ; }
docstring: Implementation of processing a save action that should be suitable for
  most subclasses.
  @param question_attempt_pending_step $pendingstep a partially initialised step
  containing all the information about the action that is being peformed.
  @return bool either {@link question_attempt::KEEP} or {@link question_attempt::DISCARD}
docstring_tokens: Implementation of processing a save action that should be suitable for most subclasses .