public function replaceAndSave($oldFile, $search, $replace, $newFile = null)
    {
        if (!isset($newFile) || $newFile == null) {
            $newFile = $oldFile;
        }
        $file = $this->filesystem->get($oldFile);
        $replacing = str_replace($search, $replace, $file);
        $this->filesystem->put($newFile, $replacing);
    }
public function replaceAndSave($oldFile, $search, $replace, $newFile = null)
    {
        if (!isset($newFile) || $newFile == null) {
            $newFile = $oldFile;
        }
        $file = $this->filesystem->get($oldFile);
        $replacing = str_replace($search, $replace, $file);
        $this->filesystem->put($newFile, $replacing);
    }
public function replaceAndSave ( $ oldFile , $ search , $ replace , $ newFile = null ) { if ( ! isset ( $ newFile ) || $ newFile == null ) { $ newFile = $ oldFile ; } $ file = $ this -> filesystem -> get ( $ oldFile ) ; $ replacing = str_replace ( $ search , $ replace , $ file ) ; $ this -> filesystem -> put ( $ newFile , $ replacing ) ; }
Open haystack, find and replace needles, save haystack.

@param  string $oldFile The haystack
@param  mixed $search String or array to look for (the needles)
@param  mixed $replace What to replace the needles for?
@param  string $newFile Where to save, defaults to $oldFile

@return void
Open haystack find and replace needles save haystack .