original_string: public function load_scale() {
          if ($this->gradetype != GRADE_TYPE_SCALE) {
              $this->scaleid = null;
          }
  
          if (!empty($this->scaleid)) {
              //do not load scale if already present
              if (empty($this->scale->id) or $this->scale->id != $this->scaleid) {
                  $this->scale = grade_scale::fetch(array('id'=>$this->scaleid));
                  if (!$this->scale) {
                      debugging('Incorrect scale id: '.$this->scaleid);
                      $this->scale = null;
                      return null;
                  }
                  $this->scale->load_items();
              }
  
              // Until scales are uniformly set to min=0 max=count(scaleitems)-1 throughout Moodle, we
              // stay with the current min=1 max=count(scaleitems)
              $this->grademax = count($this->scale->scale_items);
              $this->grademin = 1;
  
          } else {
              $this->scale = null;
          }
  
          return $this->scale;
      }
code: public function load_scale() {
          if ($this->gradetype != GRADE_TYPE_SCALE) {
              $this->scaleid = null;
          }
  
          if (!empty($this->scaleid)) {
              //do not load scale if already present
              if (empty($this->scale->id) or $this->scale->id != $this->scaleid) {
                  $this->scale = grade_scale::fetch(array('id'=>$this->scaleid));
                  if (!$this->scale) {
                      debugging('Incorrect scale id: '.$this->scaleid);
                      $this->scale = null;
                      return null;
                  }
                  $this->scale->load_items();
              }
  
              // Until scales are uniformly set to min=0 max=count(scaleitems)-1 throughout Moodle, we
              // stay with the current min=1 max=count(scaleitems)
              $this->grademax = count($this->scale->scale_items);
              $this->grademin = 1;
  
          } else {
              $this->scale = null;
          }
  
          return $this->scale;
      }
code_tokens: public function load_scale ( ) { if ( $ this -> gradetype != GRADE_TYPE_SCALE ) { $ this -> scaleid = null ; } if ( ! empty ( $ this -> scaleid ) ) { //do not load scale if already present if ( empty ( $ this -> scale -> id ) or $ this -> scale -> id != $ this -> scaleid ) { $ this -> scale = grade_scale :: fetch ( array ( 'id' => $ this -> scaleid ) ) ; if ( ! $ this -> scale ) { debugging ( 'Incorrect scale id: ' . $ this -> scaleid ) ; $ this -> scale = null ; return null ; } $ this -> scale -> load_items ( ) ; } // Until scales are uniformly set to min=0 max=count(scaleitems)-1 throughout Moodle, we // stay with the current min=1 max=count(scaleitems) $ this -> grademax = count ( $ this -> scale -> scale_items ) ; $ this -> grademin = 1 ; } else { $ this -> scale = null ; } return $ this -> scale ; }
docstring: Instantiates a grade_scale object from the DB if this item's scaleid variable is set
  
  @return grade_scale Returns a grade_scale object or null if no scale used
docstring_tokens: Instantiates a grade_scale object from the DB if this item s scaleid variable is set