fromIterator() public static method

Converts an Iterator into an observable sequence
public static fromIterator ( Iterator $iterator ) : IteratorObservable
$iterator Iterator
return Rx\Observable\IteratorObservable
 /**
  * @param $sourceDir
  * @param $targetDir
  * @param $isDryRun
  * @return Observable\ConnectableObservable
  */
 public function execute($sourceDir, $targetDir, $isDryRun)
 {
     $files = Observable::fromIterator($this->filesystem->ls($sourceDir));
     $filesWithDate = $this->fileWithDateRepository->extractDateFrom($files)->publish();
     $symlinkCommands = $this->symlinkCommandRepository->createSymlinkCommands($filesWithDate, new Path($targetDir));
     $summary = $this->summaryRepository->summarize($filesWithDate);
     $symlinkCommands->merge($summary)->subscribe($this->output);
     if (!$isDryRun) {
         $symlinkCommands->subscribeCallback(function (SymlinkCommand $cmd) {
             $this->output->onNext("write file");
             $this->linkRepository->createLink($cmd->getSource(), $cmd->getTarget());
         });
     }
     $filesWithDate->connect();
 }