original_string: public function checkFileType(Filesystem $fm, $tmp_dir)
      {
          $di = new \RecursiveDirectoryIterator($tmp_dir);
          foreach (new \RecursiveIteratorIterator($di) as $filepath => $file) {
              $fileInfo = new FileInfo($filepath, $this->getFileManager());
              $mime_valid = $this->checkMimeType($fileInfo);
              if ($mime_valid !== true) {
                  $fm->remove($tmp_dir);
                  $this->getFileManager()->throwError($mime_valid, 500);
              }
          }
  
          $fm->remove($tmp_dir);
      }
code: public function checkFileType(Filesystem $fm, $tmp_dir)
      {
          $di = new \RecursiveDirectoryIterator($tmp_dir);
          foreach (new \RecursiveIteratorIterator($di) as $filepath => $file) {
              $fileInfo = new FileInfo($filepath, $this->getFileManager());
              $mime_valid = $this->checkMimeType($fileInfo);
              if ($mime_valid !== true) {
                  $fm->remove($tmp_dir);
                  $this->getFileManager()->throwError($mime_valid, 500);
              }
          }
  
          $fm->remove($tmp_dir);
      }
code_tokens: public function checkFileType ( Filesystem $ fm , $ tmp_dir ) { $ di = new \ RecursiveDirectoryIterator ( $ tmp_dir ) ; foreach ( new \ RecursiveIteratorIterator ( $ di ) as $ filepath => $ file ) { $ fileInfo = new FileInfo ( $ filepath , $ this -> getFileManager ( ) ) ; $ mime_valid = $ this -> checkMimeType ( $ fileInfo ) ; if ( $ mime_valid !== true ) { $ fm -> remove ( $ tmp_dir ) ; $ this -> getFileManager ( ) -> throwError ( $ mime_valid , 500 ) ; } } $ fm -> remove ( $ tmp_dir ) ; }
docstring: Check if the file type is an valid file type by extracting the zip inside a temporary directory
  
  @param Filesystem $fm
  @param string     $tmp_dir
docstring_tokens: Check if the file type is an valid file type by extracting the zip inside a temporary directory