original_string: public static function get_groups($groupids) {
          $params = self::validate_parameters(self::get_groups_parameters(), array('groupids'=>$groupids));
  
          $groups = array();
          foreach ($params['groupids'] as $groupid) {
              // validate params
              $group = groups_get_group($groupid, 'id, courseid, name, idnumber, description, descriptionformat, enrolmentkey', MUST_EXIST);
  
              // now security checks
              $context = context_course::instance($group->courseid, IGNORE_MISSING);
              try {
                  self::validate_context($context);
              } catch (Exception $e) {
                  $exceptionparam = new stdClass();
                  $exceptionparam->message = $e->getMessage();
                  $exceptionparam->courseid = $group->courseid;
                  throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
              }
              require_capability('moodle/course:managegroups', $context);
  
              list($group->description, $group->descriptionformat) =
                  external_format_text($group->description, $group->descriptionformat,
                          $context->id, 'group', 'description', $group->id);
  
              $groups[] = (array)$group;
          }
  
          return $groups;
      }
code: public static function get_groups($groupids) {
          $params = self::validate_parameters(self::get_groups_parameters(), array('groupids'=>$groupids));
  
          $groups = array();
          foreach ($params['groupids'] as $groupid) {
              // validate params
              $group = groups_get_group($groupid, 'id, courseid, name, idnumber, description, descriptionformat, enrolmentkey', MUST_EXIST);
  
              // now security checks
              $context = context_course::instance($group->courseid, IGNORE_MISSING);
              try {
                  self::validate_context($context);
              } catch (Exception $e) {
                  $exceptionparam = new stdClass();
                  $exceptionparam->message = $e->getMessage();
                  $exceptionparam->courseid = $group->courseid;
                  throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
              }
              require_capability('moodle/course:managegroups', $context);
  
              list($group->description, $group->descriptionformat) =
                  external_format_text($group->description, $group->descriptionformat,
                          $context->id, 'group', 'description', $group->id);
  
              $groups[] = (array)$group;
          }
  
          return $groups;
      }
code_tokens: public static function get_groups ( $ groupids ) { $ params = self :: validate_parameters ( self :: get_groups_parameters ( ) , array ( 'groupids' => $ groupids ) ) ; $ groups = array ( ) ; foreach ( $ params [ 'groupids' ] as $ groupid ) { // validate params $ group = groups_get_group ( $ groupid , 'id, courseid, name, idnumber, description, descriptionformat, enrolmentkey' , MUST_EXIST ) ; // now security checks $ context = context_course :: instance ( $ group -> courseid , IGNORE_MISSING ) ; try { self :: validate_context ( $ context ) ; } catch ( Exception $ e ) { $ exceptionparam = new stdClass ( ) ; $ exceptionparam -> message = $ e -> getMessage ( ) ; $ exceptionparam -> courseid = $ group -> courseid ; throw new moodle_exception ( 'errorcoursecontextnotvalid' , 'webservice' , '' , $ exceptionparam ) ; } require_capability ( 'moodle/course:managegroups' , $ context ) ; list ( $ group -> description , $ group -> descriptionformat ) = external_format_text ( $ group -> description , $ group -> descriptionformat , $ context -> id , 'group' , 'description' , $ group -> id ) ; $ groups [ ] = ( array ) $ group ; } return $ groups ; }
docstring: Get groups definition specified by ids
  
  @param array $groupids arrays of group ids
  @return array of group objects (id, courseid, name, enrolmentkey)
  @since Moodle 2.2
docstring_tokens: Get groups definition specified by ids