original_string: public static function read_competency($id, $includerelated = false) {
          static::require_enabled();
          $competency = new competency($id);
  
          // First we do a permissions check.
          $context = $competency->get_context();
          if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'), $context)) {
               throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
          }
  
          // OK - all set.
          if ($includerelated) {
              $relatedcompetency = new related_competency();
              if ($related = $relatedcompetency->list_relations($id)) {
                  $competency->relatedcompetencies = $related;
              }
          }
  
          return $competency;
      }
code: public static function read_competency($id, $includerelated = false) {
          static::require_enabled();
          $competency = new competency($id);
  
          // First we do a permissions check.
          $context = $competency->get_context();
          if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'), $context)) {
               throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
          }
  
          // OK - all set.
          if ($includerelated) {
              $relatedcompetency = new related_competency();
              if ($related = $relatedcompetency->list_relations($id)) {
                  $competency->relatedcompetencies = $related;
              }
          }
  
          return $competency;
      }
code_tokens: public static function read_competency ( $ id , $ includerelated = false ) { static :: require_enabled ( ) ; $ competency = new competency ( $ id ) ; // First we do a permissions check. $ context = $ competency -> get_context ( ) ; if ( ! has_any_capability ( array ( 'moodle/competency:competencyview' , 'moodle/competency:competencymanage' ) , $ context ) ) { throw new required_capability_exception ( $ context , 'moodle/competency:competencyview' , 'nopermissions' , '' ) ; } // OK - all set. if ( $ includerelated ) { $ relatedcompetency = new related_competency ( ) ; if ( $ related = $ relatedcompetency -> list_relations ( $ id ) ) { $ competency -> relatedcompetencies = $ related ; } } return $ competency ; }
docstring: Read a the details for a single competency and return a record.
  
  Requires moodle/competency:competencyview capability at the system context.
  
  @param int $id The id of the competency to read.
  @param bool $includerelated Include related tags or not.
  @return stdClass
docstring_tokens: Read a the details for a single competency and return a record .