original_string: public function set_state($state) {
          if ($state != $this->_state + 1 || $state > self::STATE_DONE) {
              throw new coding_exception('Invalid state passed to moodle_page::set_state. We are in state ' .
                      $this->_state . ' and state ' . $state . ' was requested.');
          }
  
          if ($state == self::STATE_PRINTING_HEADER) {
              $this->starting_output();
          }
  
          $this->_state = $state;
      }
code: public function set_state($state) {
          if ($state != $this->_state + 1 || $state > self::STATE_DONE) {
              throw new coding_exception('Invalid state passed to moodle_page::set_state. We are in state ' .
                      $this->_state . ' and state ' . $state . ' was requested.');
          }
  
          if ($state == self::STATE_PRINTING_HEADER) {
              $this->starting_output();
          }
  
          $this->_state = $state;
      }
code_tokens: public function set_state ( $ state ) { if ( $ state != $ this -> _state + 1 || $ state > self :: STATE_DONE ) { throw new coding_exception ( 'Invalid state passed to moodle_page::set_state. We are in state ' . $ this -> _state . ' and state ' . $ state . ' was requested.' ) ; } if ( $ state == self :: STATE_PRINTING_HEADER ) { $ this -> starting_output ( ) ; } $ this -> _state = $ state ; }
docstring: Set the state.
  
  The state must be one of that STATE_... constants, and the state is only allowed to advance one step at a time.
  
  @param int $state The new state.
  @throws coding_exception
docstring_tokens: Set the state .