original_string: public function on_elements_end() {
  
          $numofrubrics = 0;
          foreach ($this->rubrics as $itemid => $levels) {
              $numofrubrics += count($levels);
          }
  
          if ($numofrubrics == 0) {
              $this->convert_legacy_criterion_elements();
  
          } else {
              $this->convert_legacy_rubric_elements();
          }
      }
code: public function on_elements_end() {
  
          $numofrubrics = 0;
          foreach ($this->rubrics as $itemid => $levels) {
              $numofrubrics += count($levels);
          }
  
          if ($numofrubrics == 0) {
              $this->convert_legacy_criterion_elements();
  
          } else {
              $this->convert_legacy_rubric_elements();
          }
      }
code_tokens: public function on_elements_end ( ) { $ numofrubrics = 0 ; foreach ( $ this -> rubrics as $ itemid => $ levels ) { $ numofrubrics += count ( $ levels ) ; } if ( $ numofrubrics == 0 ) { $ this -> convert_legacy_criterion_elements ( ) ; } else { $ this -> convert_legacy_rubric_elements ( ) ; } }
docstring: Processes gathered elements and rubrics
docstring_tokens: Processes gathered elements and rubrics