original_string: protected function convert_array_format($roles, $search) {
          if (empty($roles)) {
              $roles = array();
          }
          $groupedusers = array();
          foreach ($roles as $role) {
              if ($search) {
                  $a = new stdClass;
                  $a->role = $role->name;
                  $a->search = $search;
                  $groupname = get_string('matchingsearchandrole', '', $a);
              } else {
                  $groupname = $role->name;
              }
              $groupedusers[$groupname] = $role->users;
              foreach ($groupedusers[$groupname] as &$user) {
                  unset($user->roles);
                  $user->fullname = fullname($user);
                  if (!empty($user->component)) {
                      $user->infobelow = get_string('addedby', 'group',
                          get_string('pluginname', $user->component));
                  }
              }
          }
          return $groupedusers;
      }
code: protected function convert_array_format($roles, $search) {
          if (empty($roles)) {
              $roles = array();
          }
          $groupedusers = array();
          foreach ($roles as $role) {
              if ($search) {
                  $a = new stdClass;
                  $a->role = $role->name;
                  $a->search = $search;
                  $groupname = get_string('matchingsearchandrole', '', $a);
              } else {
                  $groupname = $role->name;
              }
              $groupedusers[$groupname] = $role->users;
              foreach ($groupedusers[$groupname] as &$user) {
                  unset($user->roles);
                  $user->fullname = fullname($user);
                  if (!empty($user->component)) {
                      $user->infobelow = get_string('addedby', 'group',
                          get_string('pluginname', $user->component));
                  }
              }
          }
          return $groupedusers;
      }
code_tokens: protected function convert_array_format ( $ roles , $ search ) { if ( empty ( $ roles ) ) { $ roles = array ( ) ; } $ groupedusers = array ( ) ; foreach ( $ roles as $ role ) { if ( $ search ) { $ a = new stdClass ; $ a -> role = $ role -> name ; $ a -> search = $ search ; $ groupname = get_string ( 'matchingsearchandrole' , '' , $ a ) ; } else { $ groupname = $ role -> name ; } $ groupedusers [ $ groupname ] = $ role -> users ; foreach ( $ groupedusers [ $ groupname ] as & $ user ) { unset ( $ user -> roles ) ; $ user -> fullname = fullname ( $ user ) ; if ( ! empty ( $ user -> component ) ) { $ user -> infobelow = get_string ( 'addedby' , 'group' , get_string ( 'pluginname' , $ user -> component ) ) ; } } } return $ groupedusers ; }
docstring: Creates an organised array from given data.
  
  @param array $roles array in the format returned by groups_calculate_role_people.
  @param string $search
  @return array array in the format find_users is supposed to return.
docstring_tokens: Creates an organised array from given data .