| @@ 133-142 (lines=10) @@ | ||
| 130 | * @throws \phpbu\App\Exception |
|
| 131 | * @return \phpbu\App\Adapter |
|
| 132 | */ |
|
| 133 | public function createAdapter($alias, $conf = []) |
|
| 134 | { |
|
| 135 | /** @var \phpbu\App\Adapter $adapter */ |
|
| 136 | $adapter = $this->create('adapter', $alias); |
|
| 137 | if (!($adapter instanceof Adapter)) { |
|
| 138 | throw new Exception(sprintf('adapter \'%s\' has to implement the \'Adapter\' interfaces', $alias)); |
|
| 139 | } |
|
| 140 | $adapter->setup($conf); |
|
| 141 | return $adapter; |
|
| 142 | } |
|
| 143 | ||
| 144 | /** |
|
| 145 | * Logger Factory. |
|
| @@ 174-183 (lines=10) @@ | ||
| 171 | * @throws \phpbu\App\Exception |
|
| 172 | * @return \phpbu\App\Backup\Source |
|
| 173 | */ |
|
| 174 | public function createSource($alias, $conf = []) |
|
| 175 | { |
|
| 176 | /** @var \phpbu\App\Backup\Source $source */ |
|
| 177 | $source = $this->create('source', $alias); |
|
| 178 | if (!($source instanceof Source)) { |
|
| 179 | throw new Exception(sprintf('source \'%s\' has to implement the \'Source\' interface', $alias)); |
|
| 180 | } |
|
| 181 | $source->setup($conf); |
|
| 182 | return $source; |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Check Factory. |
|
| @@ 210-219 (lines=10) @@ | ||
| 207 | * @throws \phpbu\App\Exception |
|
| 208 | * @return \phpbu\App\Backup\Crypter |
|
| 209 | */ |
|
| 210 | public function createCrypter($alias, $conf = []) |
|
| 211 | { |
|
| 212 | /** @var \phpbu\App\Backup\Crypter $crypter */ |
|
| 213 | $crypter = $this->create('crypter', $alias); |
|
| 214 | if (!($crypter instanceof Crypter)) { |
|
| 215 | throw new Exception(sprintf('Crypter \'%s\' has to implement the \'Crypter\' interface', $alias)); |
|
| 216 | } |
|
| 217 | $crypter->setup($conf); |
|
| 218 | return $crypter; |
|
| 219 | } |
|
| 220 | ||
| 221 | /** |
|
| 222 | * Sync Factory. |
|
| @@ 229-238 (lines=10) @@ | ||
| 226 | * @throws \phpbu\App\Exception |
|
| 227 | * @return \phpbu\App\Backup\Sync |
|
| 228 | */ |
|
| 229 | public function createSync($alias, $conf = []) |
|
| 230 | { |
|
| 231 | /** @var \phpbu\App\Backup\Sync $sync */ |
|
| 232 | $sync = $this->create('sync', $alias); |
|
| 233 | if (!($sync instanceof Sync)) { |
|
| 234 | throw new Exception(sprintf('sync \'%s\' has to implement the \'Sync\' interface', $alias)); |
|
| 235 | } |
|
| 236 | $sync->setup($conf); |
|
| 237 | return $sync; |
|
| 238 | } |
|
| 239 | ||
| 240 | /** |
|
| 241 | * Cleaner Factory. |
|
| @@ 248-257 (lines=10) @@ | ||
| 245 | * @throws \phpbu\App\Exception |
|
| 246 | * @return \phpbu\App\Backup\Cleaner |
|
| 247 | */ |
|
| 248 | public function createCleaner($alias, $conf = []) |
|
| 249 | { |
|
| 250 | /** @var \phpbu\App\Backup\Cleaner $cleaner */ |
|
| 251 | $cleaner = $this->create('cleaner', $alias); |
|
| 252 | if (!($cleaner instanceof Cleaner)) { |
|
| 253 | throw new Exception(sprintf('cleaner \'%s\' has to implement the \'Cleaner\' interface', $alias)); |
|
| 254 | } |
|
| 255 | $cleaner->setup($conf); |
|
| 256 | return $cleaner; |
|
| 257 | } |
|
| 258 | ||
| 259 | /** |
|
| 260 | * Extend the backup factory. |
|