Replaces strings in file content.

@param  string $from
@param  string $to

@return void
359003
protected function replace($from, $to)
    {
        if ($this->file->getExtension() === 'json') {
            $from = addslashes($from);
        }

        file_put_contents(
            $this->file->getRealPath(),
            str_replace($from, $to, $this->file->getContents())
        );
    }
765510
protected function deleteRelationData($from, $to)
    {
        $config  = Config::table($from);
        $content = $config->get();
        unset($content->relations->{$to});
        $config->put($content);
    }
776105
public function copy($from, $to)
    {
        return $this->filesystem->copy(
            $this->path($from),
            $this->path($to)
        );
    }
804822
public function renameTable(string $from, string $to): bool
    {
        $from = $this->quoter->quoteName($from);
        $to = $this->quoter->quoteName($to);
        $this->db->exec(sprintf('RENAME TABLE %s TO %s;', $from, $to));

        return true;
    }
739221
public function rename($from, $to)
    {
        // TODO: add directories support

        $contents = self::cache()->get($from);
        if (false === $contents) {
            return false;
        }

        self::cache()->delete($from);
        self::cache()->set($to, $contents);

        return true;
    }
673746
public function replaceCorrectionUser(User $from, User $to)
    {
        $corrections = $this->correctionRepo->findByUser($from);

        if (count($corrections) > 0) {
            foreach ($corrections as $correction) {
                $correction->setUser($to);
            }

            $this->om->flush();
        }

        return count($corrections);
    }
1324820
public function move( $from, $to )
	{
		try {
			$this->fs->move( $from, $to );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
969399
protected function moveUploadedFile($from, $to)
    {
        return $this->unitTest ? copy($from, $to) : @move_uploaded_file($from, $to);
    }
141710
public function rename($from, $to)
    {
        if (is_null($key = $this->search($from))) {
            return false;
        }

        $this->items[$key] = $this->getSlugFromName($to);

        return true;
    }
937897
public function translate($string, $from, $to)
    {
        foreach ($this->translatorServices as $service) {
            try {
                return $service->translate($string, $from, $to);
            } catch (TranslatorException\NoTranslationFoundException $e) {
                // Do nothing, try again.
            } catch (TranslatorException $e) {
                $this->log('error', $e->getMessage());
            } catch (\Exception $e) {
                $this->log('alert', $e->getMessage());
            }
        }

        return;
    }
658885
public function copy( $from, $to )
	{
		try {
			$this->fs->copy( $from, $to );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
812854
protected function publishFile($from, $to)
    {
        if ($this->files->exists($to) && ! $this->option('force')) {
            return;
        }

        $directory = dirname($to);

        if (! $this->files->isDirectory($directory)) {
            $this->files->makeDirectory($directory, 0755, true);
        }

        $this->files->copy($from, $to);

        $this->status($from, $to, 'File');
    }
577317
public function replaceUser(User $from, User $to)
    {
        $shareds = $this->om->getRepository('UJMExoBundle:Item\Shared')->findByUser($from);

        if (count($shareds) > 0) {
            foreach ($shareds as $shared) {
                $shared->setUser($to);
            }

            $this->om->flush();
        }

        return count($shareds);
    }
483696
public static void rename(String from, String to) {
        try {
            Files.move(Paths.get(from), Paths.get(to), StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException e) {
            log.error("Error renaming file", e);
        }
    }
268340
public function alias($from, $to = null)
	{
		if (is_array($from))
		{
			$this->aliases = array_merge($this->aliases, $from);

			return $this;
		}

		$this->aliases[$from] = $to;
		$this->cache->set($from, $to);
	}
956333
public function replaceCommentUser(User $from, User $to)
    {
        $comments = $this->commentRepo->findByUser($from);

        if (count($comments) > 0) {
            foreach ($comments as $comment) {
                $comment->setUser($to);
            }

            $this->om->flush();
        }

        return count($comments);
    }
222267
public static function replaceString($from, $to, $subject, $limit = 100000)
    {
        $from = '/' . preg_quote($from, '/') . '/';
        return preg_replace($from, $to, $subject, $limit);
    }