original_string: public static function get_default_grade_from_scale_configuration($config) {
          $config = json_decode($config);
          if (!is_array($config)) {
              throw new coding_exception('Unexpected scale configuration.');
          }
  
          // Remove the scale ID from the config.
          array_shift($config);
  
          foreach ($config as $part) {
              if ($part->scaledefault) {
                  return array((int) $part->id, (int) $part->proficient);
              }
          }
  
          throw new coding_exception('Invalid scale configuration, default not found.');
      }
code: public static function get_default_grade_from_scale_configuration($config) {
          $config = json_decode($config);
          if (!is_array($config)) {
              throw new coding_exception('Unexpected scale configuration.');
          }
  
          // Remove the scale ID from the config.
          array_shift($config);
  
          foreach ($config as $part) {
              if ($part->scaledefault) {
                  return array((int) $part->id, (int) $part->proficient);
              }
          }
  
          throw new coding_exception('Invalid scale configuration, default not found.');
      }
code_tokens: public static function get_default_grade_from_scale_configuration ( $ config ) { $ config = json_decode ( $ config ) ; if ( ! is_array ( $ config ) ) { throw new coding_exception ( 'Unexpected scale configuration.' ) ; } // Remove the scale ID from the config. array_shift ( $ config ) ; foreach ( $ config as $ part ) { if ( $ part -> scaledefault ) { return array ( ( int ) $ part -> id , ( int ) $ part -> proficient ) ; } } throw new coding_exception ( 'Invalid scale configuration, default not found.' ) ; }
docstring: Extract the default grade from a scale configuration.
  
  Returns an array where the first element is the grade, and the second
  is a boolean representing whether or not this grade is considered 'proficient'.
  
  @param  string $config JSON encoded config.
  @return array(int grade, int proficient)
docstring_tokens: Extract the default grade from a scale configuration .