1 | <?php |
||
20 | class Gpg extends Abstraction implements Simulator, Restorable |
||
21 | { |
||
22 | /** |
||
23 | * Path to gpg command |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | private $pathToGpg; |
||
28 | |||
29 | /** |
||
30 | * Gpg user name |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | private $user; |
||
35 | |||
36 | /** |
||
37 | * Keep the not encrypted file |
||
38 | * |
||
39 | * @var bool |
||
40 | */ |
||
41 | private $keepUncrypted; |
||
42 | |||
43 | /** |
||
44 | * Setup |
||
45 | * |
||
46 | * @see \phpbu\App\Backup\Crypter |
||
47 | * @param array $options |
||
48 | * @throws Exception |
||
49 | */ |
||
50 | 6 | public function setup(array $options = []) |
|
60 | |||
61 | /** |
||
62 | * Return file suffix of encrypted target |
||
63 | * |
||
64 | * @see \phpbu\App\Backup\Crypter |
||
65 | * @return string |
||
66 | */ |
||
67 | 1 | public function getSuffix() : string |
|
71 | |||
72 | /** |
||
73 | * Decrypt the backup |
||
74 | * |
||
75 | * @param \phpbu\App\Backup\Target $target |
||
76 | * @param \phpbu\App\Backup\Restore\Plan $plan |
||
77 | */ |
||
78 | 1 | public function restore(Target $target, Plan $plan) |
|
83 | |||
84 | /** |
||
85 | * Create the Executable to run the 'gpg' command |
||
86 | * |
||
87 | * @param \phpbu\App\Backup\Target $target |
||
88 | * @return \phpbu\App\Cli\Executable |
||
89 | */ |
||
90 | 3 | protected function createExecutable(Target $target): Executable |
|
94 | |||
95 | /** |
||
96 | * Create encryption Gpg |
||
97 | * |
||
98 | * @param \phpbu\App\Backup\Target $target |
||
99 | * @return \phpbu\App\Cli\Executable\Gpg |
||
100 | */ |
||
101 | 3 | private function createEncryptionGpg(Target $target): Executable\Gpg |
|
109 | |||
110 | /** |
||
111 | * Create decryption Gpg |
||
112 | * |
||
113 | * @param \phpbu\App\Backup\Target $target |
||
114 | * @return \phpbu\App\Cli\Executable\Gpg |
||
115 | */ |
||
116 | 1 | private function createDecryptionGpg(Target $target): Executable\Gpg |
|
124 | |||
125 | /** |
||
126 | * Setup an Gpg executable only thing missing is the decision of en or decryption |
||
127 | * |
||
128 | * @param \phpbu\App\Backup\Target $target |
||
129 | * @return \phpbu\App\Cli\Executable\Gpg |
||
130 | */ |
||
131 | 4 | private function createGpg(Target $target): Executable\Gpg |
|
138 | } |
||
139 |