Merge the references of two translations.

@param Translation $from
@param Translation $to
@param int         $options
499921
public static function mergeReferences(Translation $from, Translation $to, $options = self::DEFAULTS)
    {
        if ($options & self::REFERENCES_THEIRS) {
            $to->deleteReferences();
        }

        if (!($options & self::REFERENCES_OURS)) {
            foreach ($from->getReferences() as $reference) {
                $to->addReference($reference[0], $reference[1]);
            }
        }
    }
1181775
final protected function publishFile($from, $to)
    {
        // If destination directory doesn't exist,
        // we'll create before copying the config files
        $directoryDestination = dirname($to);
        if (!$this->files->isDirectory($directoryDestination)) {
            $this->files->makeDirectory($directoryDestination, 0755, true);
        }

        // Copy file to application
        $this->files->copy($from, $to);

        // Output status message
        $this->getCommand()->line(
            sprintf('<info>Copied %s</info> <comment>[%s]</comment> <info>To</info> <comment>[%s]</comment>',
                'File', str_replace(base_path(), '', realpath($from)), str_replace(base_path(), '', realpath($to)))
        );
    }
721935
public static function move($from, $to)
    {
        return self::copy($from, $to) && self::delete($from);
    }
362521
public function saveTranslationsAction($packageKey, $fromLang, $toLang, array $translationUnits) {
		$originalMatrix = $this->generateTranslationMatrix($packageKey, $fromLang, $toLang);
		$matrixToSave = array();

		foreach ($translationUnits as $translationUnit => $value) {
			if (isset($value[$toLang]) && $value[$toLang] != '') {
				$matrixToSave[$translationUnit] = $originalMatrix[$translationUnit];
				if (isset($matrixToSave[$translationUnit]['target'])) {
					$matrixToSave[$translationUnit]['oldTarget'] = $matrixToSave[$translationUnit]['target'];
				}
				$matrixToSave[$translationUnit]['target'] = $value[$toLang];
			}
		}

		// Create the Xliff file to be written to disk later on
		$xliffView = new \TYPO3\Fluid\View\TemplateView();
		$path = 'resource://Mrimann.XliffTranslator/Private/Templates/Standard/Xliff.xlf';

		$xliffView->setControllerContext($this->getControllerContext());
		$xliffView->setTemplatePathAndFilename($path);
 		$xliffView->assign('matrixToSave', $matrixToSave);

		// backup the original file before overwriting
		$this->backupXliffFile($packageKey, $toLang);

		// check if the file exists (or create an empty file in case these are the first translations)
		if (!is_dir(dirname($this->getFilePath($packageKey, $toLang)))) {
			mkdir(dirname($this->getFilePath($packageKey, $toLang)));
		}
		if (!is_file($this->getFilePath($packageKey, $toLang))) {
			touch($this->getFilePath($packageKey, $toLang));
		}

		// write the file
		$outputPath = $this->getFilePath($packageKey, $toLang);
		file_put_contents($outputPath, $xliffView->render());

		// redirect the user back to the translation page
		$this->addFlashMessage(
			'Your translations were successfully saved!',
			'Yippie!',
			'OK'
		);

		$this->redirect(
			'translate',
			'Standard',
			'Mrimann.XliffTranslator',
			array(
				'packageKey' => $packageKey,
				'fromLang' => $fromLang,
				'toLang' => $toLang
			)
		);
	}
536129
public function moveFilesWildcard($from, $to)
    {
        coollect(glob($this->dataDir($from)))->each(function ($from) use ($to) {
            $this->mkDir($dir = $this->dataDir($to));

            rename($from, $dir.'/'.basename($from));
        });
    }
1287519
public static function convert($input, $from, $to)
    {
        if (!method_exists(self::class, $to)) {
            return $input;
        }
        
        if (in_array($from, ['camel', 'pascal'])) {
            $converted = self::$from($input);
            $converted = preg_replace('/([a-z])([A-Z])/', '$1 $2', $converted);
            $converted = preg_replace('/(\D)?(\d+)(\D)?/', '$1 $2 $3', $converted);
            return self::$to($converted);
        }
        
        if (method_exists(self::class, $from)) {
            return self::$to(self::$from($input));
        }
        
        return self::$to($input);
    }
365906
public function move($from, $to)
    {
        $this->clearAll();

        $from = trim($from);
        if (!$this->validatePath($from)) {
            throw new \InvalidArgumentException('Invalid source path');
        }

        $to = trim($to);
        if (!$this->validatePath($to)) {
            throw new \InvalidArgumentException('Invalid destination path');
        }

        $this->addCommandName(self::GIT_MOVE);
        $this->addCommandSubject($from);
        $this->addCommandSubject2($to);

        return $this->getCommand();
    }
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;
    }
167468
private function copyFromTo($from, $to)
    {
        $directory = dirname($to);
        if (!is_dir($directory)) {
            mkdir($directory, 0777, true);
        }

        copy($from, $to);
    }
24236
public function migrateExpiredJobs($from, $to)
    {
        return tap(parent::migrateExpiredJobs($from, $to), function ($jobs) use ($to) {
            $this->event($to, new JobsMigrated($jobs));
        });
    }
588858
public function merge( $from, $to, EditInfo $editInfo = null ) {
		$params = array(
			'fromid' => $this->getIdFromInput( $from ),
			'toid' => $this->getIdFromInput( $to )
		);

		$this->api->postRequest( 'wbmergeitems', $params, $editInfo );
		return true;
	}
1324820
public function move( $from, $to )
	{
		try {
			$this->fs->move( $from, $to );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
1248235
public function rename($from, $to): bool
    {
        $key = $this->search($from);

        if (\is_null($key)) {
            return false;
        }

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

        return true;
    }
323028
public function revisions(string $from, string $to): Compare
    {
        $this->compare = escapeshellarg($from) . ' ' . escapeshellarg($to);
        return $this;
    }
837409
public function move($from, $to)
    {
        event(new Events\FileMoving($from, $to));
        $moved = $this->disk()->move($from, $to);
        event(new Events\FileMoved($from, $to, $moved));

        return $moved;
    }
282801
private function getReplacementString($from, $to)
    {
        if (is_array($from) && is_array($to)) {
            if (count($from) == count($to)) {
                $sedStrings = [];
                $fromSize = count($from);
                for ($i = 0; $i < $fromSize; $i++) {
                    $sedStrings[] = $this->getReplacementCommand($from[$i], $to[$i]);
                }
                return implode(';', $sedStrings);
            } else {
                throw new InvalidArgumentException("Number of items in 'fromText' (" . count($from) . ") is different to 'toText' (" . count($to) . ")");
            }
        } elseif (is_array($from) || is_array($to)) {
            throw new InvalidArgumentException("Only one of fromText or toText is an array, both should be arrays or string");
        } else {
            return $this->getReplacementCommand($from, $to);
        }
    }
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())
        );
    }