original_string: public static function get_bands_count_and_width($quiz) {
          $bands = $quiz->grade;
          while ($bands > 20 || $bands <= 10) {
              if ($bands > 50) {
                  $bands /= 5;
              } else if ($bands > 20) {
                  $bands /= 2;
              }
              if ($bands < 4) {
                  $bands *= 5;
              } else if ($bands <= 10) {
                  $bands *= 2;
              }
          }
          // See MDL-34589. Using doubles as array keys causes problems in PHP 5.4, hence the explicit cast to int.
          $bands = (int) ceil($bands);
          return [$bands, $quiz->grade / $bands];
      }
code: public static function get_bands_count_and_width($quiz) {
          $bands = $quiz->grade;
          while ($bands > 20 || $bands <= 10) {
              if ($bands > 50) {
                  $bands /= 5;
              } else if ($bands > 20) {
                  $bands /= 2;
              }
              if ($bands < 4) {
                  $bands *= 5;
              } else if ($bands <= 10) {
                  $bands *= 2;
              }
          }
          // See MDL-34589. Using doubles as array keys causes problems in PHP 5.4, hence the explicit cast to int.
          $bands = (int) ceil($bands);
          return [$bands, $quiz->grade / $bands];
      }
code_tokens: public static function get_bands_count_and_width ( $ quiz ) { $ bands = $ quiz -> grade ; while ( $ bands > 20 || $ bands <= 10 ) { if ( $ bands > 50 ) { $ bands /= 5 ; } else if ( $ bands > 20 ) { $ bands /= 2 ; } if ( $ bands < 4 ) { $ bands *= 5 ; } else if ( $ bands <= 10 ) { $ bands *= 2 ; } } // See MDL-34589. Using doubles as array keys causes problems in PHP 5.4, hence the explicit cast to int. $ bands = ( int ) ceil ( $ bands ) ; return [ $ bands , $ quiz -> grade / $ bands ] ; }
docstring: Get the bands configuration for the quiz.
  
  This returns the configuration for having between 11 and 20 bars in
  a chart based on the maximum grade to be given on a quiz. The width of
  a band is the number of grade points it encapsulates.
  
  @param object $quiz The quiz object.
  @return array Contains the number of bands, and their width.
docstring_tokens: Get the bands configuration for the quiz .