original_string: protected function normalize_grades(array $assessments, array $diminfo) {
          foreach ($assessments as $asid => $assessment) {
              foreach ($assessment->dimgrades as $dimid => $dimgrade) {
                  $dimmin = $diminfo[$dimid]->min;
                  $dimmax = $diminfo[$dimid]->max;
                  if ($dimmin == $dimmax) {
                      $assessment->dimgrades[$dimid] = grade_floatval($dimmax);
                  } else {
                      $assessment->dimgrades[$dimid] = grade_floatval(($dimgrade - $dimmin) / ($dimmax - $dimmin) * 100);
                  }
              }
          }
          return $assessments;
      }
code: protected function normalize_grades(array $assessments, array $diminfo) {
          foreach ($assessments as $asid => $assessment) {
              foreach ($assessment->dimgrades as $dimid => $dimgrade) {
                  $dimmin = $diminfo[$dimid]->min;
                  $dimmax = $diminfo[$dimid]->max;
                  if ($dimmin == $dimmax) {
                      $assessment->dimgrades[$dimid] = grade_floatval($dimmax);
                  } else {
                      $assessment->dimgrades[$dimid] = grade_floatval(($dimgrade - $dimmin) / ($dimmax - $dimmin) * 100);
                  }
              }
          }
          return $assessments;
      }
code_tokens: protected function normalize_grades ( array $ assessments , array $ diminfo ) { foreach ( $ assessments as $ asid => $ assessment ) { foreach ( $ assessment -> dimgrades as $ dimid => $ dimgrade ) { $ dimmin = $ diminfo [ $ dimid ] -> min ; $ dimmax = $ diminfo [ $ dimid ] -> max ; if ( $ dimmin == $ dimmax ) { $ assessment -> dimgrades [ $ dimid ] = grade_floatval ( $ dimmax ) ; } else { $ assessment -> dimgrades [ $ dimid ] = grade_floatval ( ( $ dimgrade - $ dimmin ) / ( $ dimmax - $ dimmin ) * 100 ) ; } } } return $ assessments ; }
docstring: Normalizes the dimension grades to the interval 0.00000 - 100.00000
  
  Note: this heavily relies on PHP5 way of handling references in array of stdclasses. Hopefully
  it will not change again soon.
  
  @param array $assessments of stdclass as returned by {@see self::prepare_data_from_recordset()}
  @param array $diminfo of stdclass
  @return array of stdclass with the same structure as $assessments
docstring_tokens: Normalizes the dimension grades to the interval 0 . 00000 - 100 . 00000