original_string: protected function filterItemList(&$itemList, $filter)
      {
          if (!$filter)
              return;
  
          $result = [];
          foreach ($itemList as $item) {
              if ($item->getFileType() == $filter) {
                  $result[] = $item;
              }
          }
  
          $itemList = $result;
      }
code: protected function filterItemList(&$itemList, $filter)
      {
          if (!$filter)
              return;
  
          $result = [];
          foreach ($itemList as $item) {
              if ($item->getFileType() == $filter) {
                  $result[] = $item;
              }
          }
  
          $itemList = $result;
      }
code_tokens: protected function filterItemList ( & $ itemList , $ filter ) { if ( ! $ filter ) return ; $ result = [ ] ; foreach ( $ itemList as $ item ) { if ( $ item -> getFileType ( ) == $ filter ) { $ result [ ] = $ item ; } } $ itemList = $ result ; }
docstring: Filters item list by file type.
  @param array $itemList Specifies the item list to sort.
  @param string $filter Determines the document type filtering preference.
  Supported values are 'image', 'video', 'audio', 'document' (see FILE_TYPE_XXX constants of MediaLibraryItem class).
docstring_tokens: Filters item list by file type .