original_string: public function get_list_of_countries($returnall = false, $lang = null) {
          global $CFG;
  
          if ($lang === null) {
              $lang = current_language();
          }
  
          $countries = $this->load_component_strings('core_countries', $lang);
          core_collator::asort($countries);
          if (!$returnall and !empty($CFG->allcountrycodes)) {
              $enabled = explode(',', $CFG->allcountrycodes);
              $return = array();
              foreach ($enabled as $c) {
                  if (isset($countries[$c])) {
                      $return[$c] = $countries[$c];
                  }
              }
              return $return;
          }
  
          return $countries;
      }
code: public function get_list_of_countries($returnall = false, $lang = null) {
          global $CFG;
  
          if ($lang === null) {
              $lang = current_language();
          }
  
          $countries = $this->load_component_strings('core_countries', $lang);
          core_collator::asort($countries);
          if (!$returnall and !empty($CFG->allcountrycodes)) {
              $enabled = explode(',', $CFG->allcountrycodes);
              $return = array();
              foreach ($enabled as $c) {
                  if (isset($countries[$c])) {
                      $return[$c] = $countries[$c];
                  }
              }
              return $return;
          }
  
          return $countries;
      }
code_tokens: public function get_list_of_countries ( $ returnall = false , $ lang = null ) { global $ CFG ; if ( $ lang === null ) { $ lang = current_language ( ) ; } $ countries = $ this -> load_component_strings ( 'core_countries' , $ lang ) ; core_collator :: asort ( $ countries ) ; if ( ! $ returnall and ! empty ( $ CFG -> allcountrycodes ) ) { $ enabled = explode ( ',' , $ CFG -> allcountrycodes ) ; $ return = array ( ) ; foreach ( $ enabled as $ c ) { if ( isset ( $ countries [ $ c ] ) ) { $ return [ $ c ] = $ countries [ $ c ] ; } } return $ return ; } return $ countries ; }
docstring: Returns a localised list of all country names, sorted by localised name.
  
  @param bool $returnall return all or just enabled
  @param string $lang moodle translation language, null means use current
  @return array two-letter country code => translated name.
docstring_tokens: Returns a localised list of all country names sorted by localised name .