original_string: private function copyRecursive($source, $target)
      {
          if (!is_dir($source)) {
              $this->filesystem->ensureDirectoryExists(dirname($target));
              copy($source, $target);
  
              return;
          }
  
          $iterator = new \RecursiveIteratorIterator(
              new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS),
              \RecursiveIteratorIterator::SELF_FIRST
          );
  
          $this->filesystem->ensureDirectoryExists($target);
  
          foreach ($iterator as $file) {
              $targetPath = $target . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
              if ($file->isDir()) {
                  $this->filesystem->ensureDirectoryExists($targetPath);
              } else {
                  copy($file->getPathname(), $targetPath);
              }
          }
      }
code: private function copyRecursive($source, $target)
      {
          if (!is_dir($source)) {
              $this->filesystem->ensureDirectoryExists(dirname($target));
              copy($source, $target);
  
              return;
          }
  
          $iterator = new \RecursiveIteratorIterator(
              new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS),
              \RecursiveIteratorIterator::SELF_FIRST
          );
  
          $this->filesystem->ensureDirectoryExists($target);
  
          foreach ($iterator as $file) {
              $targetPath = $target . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
              if ($file->isDir()) {
                  $this->filesystem->ensureDirectoryExists($targetPath);
              } else {
                  copy($file->getPathname(), $targetPath);
              }
          }
      }
code_tokens: private function copyRecursive ( $ source , $ target ) { if ( ! is_dir ( $ source ) ) { $ this -> filesystem -> ensureDirectoryExists ( dirname ( $ target ) ) ; copy ( $ source , $ target ) ; return ; } $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ source , \ RecursiveDirectoryIterator :: SKIP_DOTS ) , \ RecursiveIteratorIterator :: SELF_FIRST ) ; $ this -> filesystem -> ensureDirectoryExists ( $ target ) ; foreach ( $ iterator as $ file ) { $ targetPath = $ target . DIRECTORY_SEPARATOR . $ iterator -> getSubPathName ( ) ; if ( $ file -> isDir ( ) ) { $ this -> filesystem -> ensureDirectoryExists ( $ targetPath ) ; } else { copy ( $ file -> getPathname ( ) , $ targetPath ) ; } } }
docstring: Recursive copy source file or directory to target path.
  
  @param string $source The source file or folder.
  @param string $target The target file or folder.
  
  @return void
docstring_tokens: Recursive copy source file or directory to target path .