original_string: private function group_tags(array $tags){
      $res = [];
      if ( !empty($tags) ){
        foreach ( $tags as $i => $tag ){
          // Skip the 'memberof' tag
          if ( $tag['tag'] === 'memberof' ){
            continue;
          }
          $t = $tag['tag'];
          unset($tag['tag']);
          $res[$t][] = $tag['text'] ?? $tag;
        }
      }
      return array_map(function($r){
        if ( is_array($r) && (count($r) === 1) ){
          return $r[0];
        }
        return $r;
      }, $res);
    }
code: private function group_tags(array $tags){
      $res = [];
      if ( !empty($tags) ){
        foreach ( $tags as $i => $tag ){
          // Skip the 'memberof' tag
          if ( $tag['tag'] === 'memberof' ){
            continue;
          }
          $t = $tag['tag'];
          unset($tag['tag']);
          $res[$t][] = $tag['text'] ?? $tag;
        }
      }
      return array_map(function($r){
        if ( is_array($r) && (count($r) === 1) ){
          return $r[0];
        }
        return $r;
      }, $res);
    }
code_tokens: private function group_tags ( array $ tags ) { $ res = [ ] ; if ( ! empty ( $ tags ) ) { foreach ( $ tags as $ i => $ tag ) { // Skip the 'memberof' tag if ( $ tag [ 'tag' ] === 'memberof' ) { continue ; } $ t = $ tag [ 'tag' ] ; unset ( $ tag [ 'tag' ] ) ; $ res [ $ t ] [ ] = $ tag [ 'text' ] ?? $ tag ; } } return array_map ( function ( $ r ) { if ( is_array ( $ r ) && ( count ( $ r ) === 1 ) ) { return $ r [ 0 ] ; } return $ r ; } , $ res ) ; }
docstring: Groups tags by name
  
  @param array $tags The tags list
  @return array
docstring_tokens: Groups tags by name