original_string: public static function add_related_competency($competencyid, $relatedcompetencyid) {
          static::require_enabled();
          $competency1 = new competency($competencyid);
          $competency2 = new competency($relatedcompetencyid);
  
          require_capability('moodle/competency:competencymanage', $competency1->get_context());
  
          $relatedcompetency = related_competency::get_relation($competency1->get('id'), $competency2->get('id'));
          if (!$relatedcompetency->get('id')) {
              $relatedcompetency->create();
              return true;
          }
  
          return true;
      }
code: public static function add_related_competency($competencyid, $relatedcompetencyid) {
          static::require_enabled();
          $competency1 = new competency($competencyid);
          $competency2 = new competency($relatedcompetencyid);
  
          require_capability('moodle/competency:competencymanage', $competency1->get_context());
  
          $relatedcompetency = related_competency::get_relation($competency1->get('id'), $competency2->get('id'));
          if (!$relatedcompetency->get('id')) {
              $relatedcompetency->create();
              return true;
          }
  
          return true;
      }
code_tokens: public static function add_related_competency ( $ competencyid , $ relatedcompetencyid ) { static :: require_enabled ( ) ; $ competency1 = new competency ( $ competencyid ) ; $ competency2 = new competency ( $ relatedcompetencyid ) ; require_capability ( 'moodle/competency:competencymanage' , $ competency1 -> get_context ( ) ) ; $ relatedcompetency = related_competency :: get_relation ( $ competency1 -> get ( 'id' ) , $ competency2 -> get ( 'id' ) ) ; if ( ! $ relatedcompetency -> get ( 'id' ) ) { $ relatedcompetency -> create ( ) ; return true ; } return true ; }
docstring: Add a related competency.
  
  @param int $competencyid The id of the competency
  @param int $relatedcompetencyid The id of the related competency.
  @return bool False when create failed, true on success, or if the relation already existed.
docstring_tokens: Add a related competency .