original_string: public function expand($types, $keepgroups=false, $keepmimetypes=false) {
  
          $expanded = [];
  
          foreach ($this->normalize_file_types($types) as $type) {
              if ($group = $this->is_filetype_group($type)) {
                  foreach ($group->extensions as $ext) {
                      $expanded[$ext] = true;
                  }
                  if ($keepgroups) {
                      $expanded[$type] = true;
                  }
  
              } else if ($this->looks_like_mimetype($type)) {
                  // A mime type expands to the associated extensions.
                  foreach (file_get_typegroup('extension', [$type]) as $ext) {
                      $expanded[$ext] = true;
                  }
                  if ($keepmimetypes) {
                      $expanded[$type] = true;
                  }
  
              } else {
                  // Single extension expands to itself.
                  $expanded[$type] = true;
              }
          }
  
          return array_keys($expanded);
      }
code: public function expand($types, $keepgroups=false, $keepmimetypes=false) {
  
          $expanded = [];
  
          foreach ($this->normalize_file_types($types) as $type) {
              if ($group = $this->is_filetype_group($type)) {
                  foreach ($group->extensions as $ext) {
                      $expanded[$ext] = true;
                  }
                  if ($keepgroups) {
                      $expanded[$type] = true;
                  }
  
              } else if ($this->looks_like_mimetype($type)) {
                  // A mime type expands to the associated extensions.
                  foreach (file_get_typegroup('extension', [$type]) as $ext) {
                      $expanded[$ext] = true;
                  }
                  if ($keepmimetypes) {
                      $expanded[$type] = true;
                  }
  
              } else {
                  // Single extension expands to itself.
                  $expanded[$type] = true;
              }
          }
  
          return array_keys($expanded);
      }
code_tokens: public function expand ( $ types , $ keepgroups = false , $ keepmimetypes = false ) { $ expanded = [ ] ; foreach ( $ this -> normalize_file_types ( $ types ) as $ type ) { if ( $ group = $ this -> is_filetype_group ( $ type ) ) { foreach ( $ group -> extensions as $ ext ) { $ expanded [ $ ext ] = true ; } if ( $ keepgroups ) { $ expanded [ $ type ] = true ; } } else if ( $ this -> looks_like_mimetype ( $ type ) ) { // A mime type expands to the associated extensions. foreach ( file_get_typegroup ( 'extension' , [ $ type ] ) as $ ext ) { $ expanded [ $ ext ] = true ; } if ( $ keepmimetypes ) { $ expanded [ $ type ] = true ; } } else { // Single extension expands to itself. $ expanded [ $ type ] = true ; } } return array_keys ( $ expanded ) ; }
docstring: Expands the file types into the list of file extensions.
  
  The groups and mimetypes are expanded into the list of their associated file
  extensions. Depending on the $keepgroups and $keepmimetypes, the groups
  and mimetypes themselves are either kept in the list or removed.
  
  @param string|array $types
  @param bool $keepgroups Keep the group item in the list after expansion
  @param bool $keepmimetypes Keep the mimetype item in the list after expansion
  @return array list of extensions and eventually groups and types
docstring_tokens: Expands the file types into the list of file extensions .