original_string: public static function create_competency(stdClass $record) {
          static::require_enabled();
          $competency = new competency(0, $record);
  
          // First we do a permissions check.
          require_capability('moodle/competency:competencymanage', $competency->get_context());
  
          // Reset the sortorder, use reorder instead.
          $competency->set('sortorder', 0);
          $competency->create();
  
          \core\event\competency_created::create_from_competency($competency)->trigger();
  
          // Reset the rule of the parent.
          $parent = $competency->get_parent();
          if ($parent) {
              $parent->reset_rule();
              $parent->update();
          }
  
          return $competency;
      }
code: public static function create_competency(stdClass $record) {
          static::require_enabled();
          $competency = new competency(0, $record);
  
          // First we do a permissions check.
          require_capability('moodle/competency:competencymanage', $competency->get_context());
  
          // Reset the sortorder, use reorder instead.
          $competency->set('sortorder', 0);
          $competency->create();
  
          \core\event\competency_created::create_from_competency($competency)->trigger();
  
          // Reset the rule of the parent.
          $parent = $competency->get_parent();
          if ($parent) {
              $parent->reset_rule();
              $parent->update();
          }
  
          return $competency;
      }
code_tokens: public static function create_competency ( stdClass $ record ) { static :: require_enabled ( ) ; $ competency = new competency ( 0 , $ record ) ; // First we do a permissions check. require_capability ( 'moodle/competency:competencymanage' , $ competency -> get_context ( ) ) ; // Reset the sortorder, use reorder instead. $ competency -> set ( 'sortorder' , 0 ) ; $ competency -> create ( ) ; \ core \ event \ competency_created :: create_from_competency ( $ competency ) -> trigger ( ) ; // Reset the rule of the parent. $ parent = $ competency -> get_parent ( ) ; if ( $ parent ) { $ parent -> reset_rule ( ) ; $ parent -> update ( ) ; } return $ competency ; }
docstring: Create a competency from a record containing all the data for the class.
  
  Requires moodle/competency:competencymanage capability at the system context.
  
  @param stdClass $record Record containing all the data for an instance of the class.
  @return competency
docstring_tokens: Create a competency from a record containing all the data for the class .