/**
  * Sync local to remote directory.
  *
  * @param string       $remoteDir The remote origin directory
  * @param string       $localDir The local target directory
  * @param array        $options   An array of boolean options
  *                                Valid options are:
  *                                - $options['override'] Whether to override an existing file on copy or not (see copy())
  *                                - $options['delete'] Whether to delete files that are not in the source directory (defaults to false)
  *
  * @return exit code
  */
 public function syncLocalToRemote($localDir, $remoteDir, $options = array())
 {
     $this->exec->run(strtr('rsync %delete% --recursive --checksum --compress %extra_rsync_options% --rsh \'ssh -p %ssh_port% %ssh_identity_file_option%\' %local_dir%/ %ssh_username%@%ssh_host%:%remote_dir%', ['%delete%' => isset($options['delete']) && $options['delete'] ? '--delete' : '', '%ssh_username%' => $this->sshExec->getOption('ssh_user'), '%ssh_host%' => $this->sshExec->getOption('ssh_host'), '%ssh_port%' => $this->sshExec->getOption('ssh_port'), '%ssh_identity_file_option%' => $this->sshExec->getOption('ssh_identity_file') ? '-i ' . $this->sshExec->getOption('ssh_identity_file') : '', '%extra_rsync_options%' => '--verbose --human-readable --progress', '%remote_dir%' => $remoteDir, '%local_dir%' => $localDir]));
     if ($this->exec->getLastReturnStatus() !== 0) {
         !$this->logger ?: $this->logger->error(sprintf('Error sync local to  %s to remote %s', $localDir, $remoteDir));
     }
     return $this->exec->getLastReturnStatus();
 }
 /**
  * Return last return status of the last Unix command has been executed
  *
  * @return int
  */
 public function getLastReturnStatus()
 {
     return $this->sshExec->getLastReturnStatus();
 }