Rx\Observable::map PHP Method

map() public method

Takes a transforming function that operates on each element.
public map ( callable $selector ) : Rx\Observable\AnonymousObservable
$selector callable
return Rx\Observable\AnonymousObservable
    public function map(callable $selector)
    {
        return $this->lift(function () use($selector) {
            return new MapOperator($selector);
        });
    }

Usage Example

 /**
  * @param Observable $observable of FileWithDate
  * @param Path $targetPath
  * @return Observable
  */
 public function createSymlinkCommands(Observable $observable, Path $targetPath)
 {
     return $observable->map(function (FileWithDate $file) use($targetPath) {
         return SymlinkCommand::from($file->getFile()->getRealPath(), "{$targetPath->getValue()}/{$file->getSymlinkTarget()}");
     });
 }