original_string: public function get_scale_from_competency(competency $competency) {
          $scaleid = $competency->get('scaleid');
          if ($scaleid !== null && !isset($this->scales[$scaleid])) {
              $this->scales[$scaleid] = $competency->get_scale();
  
          } else if ($scaleid === null) {
              $framework = $this->get_framework_from_competency($competency);
              $scaleid = $framework->get('scaleid');
              if (!isset($this->scales[$scaleid])) {
                  $this->scales[$scaleid] = $framework->get_scale();
              }
          }
  
          return $this->scales[$scaleid];
      }
code: public function get_scale_from_competency(competency $competency) {
          $scaleid = $competency->get('scaleid');
          if ($scaleid !== null && !isset($this->scales[$scaleid])) {
              $this->scales[$scaleid] = $competency->get_scale();
  
          } else if ($scaleid === null) {
              $framework = $this->get_framework_from_competency($competency);
              $scaleid = $framework->get('scaleid');
              if (!isset($this->scales[$scaleid])) {
                  $this->scales[$scaleid] = $framework->get_scale();
              }
          }
  
          return $this->scales[$scaleid];
      }
code_tokens: public function get_scale_from_competency ( competency $ competency ) { $ scaleid = $ competency -> get ( 'scaleid' ) ; if ( $ scaleid !== null && ! isset ( $ this -> scales [ $ scaleid ] ) ) { $ this -> scales [ $ scaleid ] = $ competency -> get_scale ( ) ; } else if ( $ scaleid === null ) { $ framework = $ this -> get_framework_from_competency ( $ competency ) ; $ scaleid = $ framework -> get ( 'scaleid' ) ; if ( ! isset ( $ this -> scales [ $ scaleid ] ) ) { $ this -> scales [ $ scaleid ] = $ framework -> get_scale ( ) ; } } return $ this -> scales [ $ scaleid ] ; }
docstring: Get the scale of a competency.
  
  /!\ Make sure that this is always kept in sync with:
  - core_competency\competency::get_scale()
  - core_competency\competency_framework::get_scale()
  
  @param competency $competency The competency.
  @return \grade_scale
docstring_tokens: Get the scale of a competency .