original_string: public static function create_competency($competency) {
          global $PAGE;
  
          $params = self::validate_parameters(self::create_competency_parameters(), array(
              'competency' => $competency
          ));
  
          $params = $params['competency'];
          $framework = api::read_framework($params['competencyframeworkid']);
          $context = $framework->get_context();
          self::validate_context($context);
          $output = $PAGE->get_renderer('core');
  
          $params = (object) $params;
          $result = api::create_competency($params);
          $exporter = new competency_exporter($result, array('context' => $context));
          $record = $exporter->export($output);
          return $record;
      }
code: public static function create_competency($competency) {
          global $PAGE;
  
          $params = self::validate_parameters(self::create_competency_parameters(), array(
              'competency' => $competency
          ));
  
          $params = $params['competency'];
          $framework = api::read_framework($params['competencyframeworkid']);
          $context = $framework->get_context();
          self::validate_context($context);
          $output = $PAGE->get_renderer('core');
  
          $params = (object) $params;
          $result = api::create_competency($params);
          $exporter = new competency_exporter($result, array('context' => $context));
          $record = $exporter->export($output);
          return $record;
      }
code_tokens: public static function create_competency ( $ competency ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: create_competency_parameters ( ) , array ( 'competency' => $ competency ) ) ; $ params = $ params [ 'competency' ] ; $ framework = api :: read_framework ( $ params [ 'competencyframeworkid' ] ) ; $ context = $ framework -> get_context ( ) ; self :: validate_context ( $ context ) ; $ output = $ PAGE -> get_renderer ( 'core' ) ; $ params = ( object ) $ params ; $ result = api :: create_competency ( $ params ) ; $ exporter = new competency_exporter ( $ result , array ( 'context' => $ context ) ) ; $ record = $ exporter -> export ( $ output ) ; return $ record ; }
docstring: Create a new competency
  
  @param array $competency All the fields for a competency record (including id)
  @return array the competency
docstring_tokens: Create a new competency