original_string: public function get_related_badges(bool $activeonly = false) {
          global $DB;
  
          $params = array('badgeid' => $this->id, 'badgeid2' => $this->id, 'badgeid3' => $this->id);
          $query = "SELECT DISTINCT b.id, b.name, b.version, b.language, b.type
                      FROM {badge_related} br
                      JOIN {badge} b ON (br.relatedbadgeid = b.id OR br.badgeid = b.id)
                     WHERE (br.badgeid = :badgeid OR br.relatedbadgeid = :badgeid2) AND b.id != :badgeid3";
          if ($activeonly) {
              $query .= " AND b.status <> :status";
              $params['status'] = BADGE_STATUS_INACTIVE;
          }
          $relatedbadges = $DB->get_records_sql($query, $params);
          return $relatedbadges;
      }
code: public function get_related_badges(bool $activeonly = false) {
          global $DB;
  
          $params = array('badgeid' => $this->id, 'badgeid2' => $this->id, 'badgeid3' => $this->id);
          $query = "SELECT DISTINCT b.id, b.name, b.version, b.language, b.type
                      FROM {badge_related} br
                      JOIN {badge} b ON (br.relatedbadgeid = b.id OR br.badgeid = b.id)
                     WHERE (br.badgeid = :badgeid OR br.relatedbadgeid = :badgeid2) AND b.id != :badgeid3";
          if ($activeonly) {
              $query .= " AND b.status <> :status";
              $params['status'] = BADGE_STATUS_INACTIVE;
          }
          $relatedbadges = $DB->get_records_sql($query, $params);
          return $relatedbadges;
      }
code_tokens: public function get_related_badges ( bool $ activeonly = false ) { global $ DB ; $ params = array ( 'badgeid' => $ this -> id , 'badgeid2' => $ this -> id , 'badgeid3' => $ this -> id ) ; $ query = "SELECT DISTINCT b.id, b.name, b.version, b.language, b.type
                      FROM {badge_related} br
                      JOIN {badge} b ON (br.relatedbadgeid = b.id OR br.badgeid = b.id)
                     WHERE (br.badgeid = :badgeid OR br.relatedbadgeid = :badgeid2) AND b.id != :badgeid3" ; if ( $ activeonly ) { $ query .= " AND b.status <> :status" ; $ params [ 'status' ] = BADGE_STATUS_INACTIVE ; } $ relatedbadges = $ DB -> get_records_sql ( $ query , $ params ) ; return $ relatedbadges ; }
docstring: Get related badges of badge.
  
  @param bool $activeonly Do not get the inactive badges when is true.
  @return array Related badges information.
docstring_tokens: Get related badges of badge .