/** * Execute encryption. * * @param \phpbu\App\Configuration\Backup $backup * @param \phpbu\App\Backup\Target $target */ protected function executeCrypt(Configuration\Backup $backup, Target $target) { $crypt = $backup->getCrypt(); if (!empty($crypt)) { try { $this->result->cryptStart($crypt); if ($this->failure && $crypt->skipOnFailure) { $this->result->cryptSkipped($crypt); } else { $c = $this->factory->createCrypter($crypt->type, $crypt->options); $c->crypt($target, $this->result); $target->setCrypter($c); } } catch (Backup\Crypter\Exception $e) { $this->failure = true; $this->result->addError($e); $this->result->cryptFailed($crypt); } } }