original_string: public static function get_categories($id, $from, $limit) {
          $params = self::validate_parameters(self::get_categories_parameters(), array(
              'id' => $id,
              'from' => $from,
              'limit' => $limit
          ));
          $id = $params['id'];
          $from = $params['from'];
          $limit = $params['limit'];
          $warnings = array();
  
          // Get and validate the glossary.
          list($glossary, $context) = self::validate_glossary($id);
  
          // Fetch the categories.
          $categories = array();
          list($records, $count) = glossary_get_categories($glossary, $from, $limit);
          foreach ($records as $category) {
              $category->name = external_format_string($category->name, $context->id);
              $categories[] = $category;
          }
  
          return array(
              'count' => $count,
              'categories' => $categories,
              'warnings' => array(),
          );
      }
code: public static function get_categories($id, $from, $limit) {
          $params = self::validate_parameters(self::get_categories_parameters(), array(
              'id' => $id,
              'from' => $from,
              'limit' => $limit
          ));
          $id = $params['id'];
          $from = $params['from'];
          $limit = $params['limit'];
          $warnings = array();
  
          // Get and validate the glossary.
          list($glossary, $context) = self::validate_glossary($id);
  
          // Fetch the categories.
          $categories = array();
          list($records, $count) = glossary_get_categories($glossary, $from, $limit);
          foreach ($records as $category) {
              $category->name = external_format_string($category->name, $context->id);
              $categories[] = $category;
          }
  
          return array(
              'count' => $count,
              'categories' => $categories,
              'warnings' => array(),
          );
      }
code_tokens: public static function get_categories ( $ id , $ from , $ limit ) { $ params = self :: validate_parameters ( self :: get_categories_parameters ( ) , array ( 'id' => $ id , 'from' => $ from , 'limit' => $ limit ) ) ; $ id = $ params [ 'id' ] ; $ from = $ params [ 'from' ] ; $ limit = $ params [ 'limit' ] ; $ warnings = array ( ) ; // Get and validate the glossary. list ( $ glossary , $ context ) = self :: validate_glossary ( $ id ) ; // Fetch the categories. $ categories = array ( ) ; list ( $ records , $ count ) = glossary_get_categories ( $ glossary , $ from , $ limit ) ; foreach ( $ records as $ category ) { $ category -> name = external_format_string ( $ category -> name , $ context -> id ) ; $ categories [ ] = $ category ; } return array ( 'count' => $ count , 'categories' => $ categories , 'warnings' => array ( ) , ) ; }
docstring: Get the categories of a glossary.
  
  @param int $id The glossary ID.
  @param int $from Start returning records from here.
  @param int $limit Number of records to return.
  @return array Containing count, categories and warnings.
  @since Moodle 3.1
  @throws moodle_exception
docstring_tokens: Get the categories of a glossary .