public static function get_proficiency_of_grade_from_scale_configuration($config, $grade) {
        $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->id == $grade) {
                return (int) $part->proficient;
            }
        }

        return 0;
    }
public static function get_proficiency_of_grade_from_scale_configuration($config, $grade) {
        $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->id == $grade) {
                return (int) $part->proficient;
            }
        }

        return 0;
    }
public static function get_proficiency_of_grade_from_scale_configuration ( $ config , $ grade ) { $ 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 -> id == $ grade ) { return ( int ) $ part -> proficient ; } } return 0 ; }
Extract the proficiency of a grade from a scale configuration.

@param  string $config JSON encoded config.
@param  int $grade The grade.
@return int Representing a boolean
Extract the proficiency of a grade from a scale configuration .