/** * Execute the syncs. * * @param \phpbu\App\Configuration\Backup $backup * @param \phpbu\App\Backup\Target $target * @throws \Exception */ protected function executeSyncs(Configuration\Backup $backup, Target $target) { /** @var \phpbu\App\Configuration\Backup\Sync $sync */ foreach ($backup->getSyncs() as $sync) { try { $this->result->syncStart($sync); if ($this->failure && $sync->skipOnFailure) { $this->result->syncSkipped($sync); } else { $s = $this->factory->createSync($sync->type, $sync->options); $s->sync($target, $this->result); $this->result->syncEnd($sync); } } catch (Backup\Sync\Exception $e) { $this->failure = true; $this->result->addError($e); $this->result->syncFailed($sync); } } }