1 | <?php |
||
22 | trait Cleanable |
||
23 | { |
||
24 | /** |
||
25 | * Cleaner configuration. |
||
26 | * |
||
27 | * @var \phpbu\App\Configuration\Backup\Cleanup |
||
28 | */ |
||
29 | protected $cleanupConfig; |
||
30 | |||
31 | /** |
||
32 | * The cleaner instance executing the actual cleaning process. |
||
33 | * |
||
34 | * @var \phpbu\App\Backup\Cleaner |
||
35 | */ |
||
36 | protected $cleaner; |
||
37 | |||
38 | /** |
||
39 | * Simulation indicator. |
||
40 | * |
||
41 | * @var bool |
||
42 | */ |
||
43 | protected $isSimulation = false; |
||
44 | |||
45 | /** |
||
46 | * Check sync clean configuration entities and set up a proper cleaner |
||
47 | * |
||
48 | * @param array $options |
||
49 | * @throws \phpbu\App\Exception |
||
50 | */ |
||
51 | 19 | public function setUpCleanable(array $options) |
|
68 | |||
69 | /** |
||
70 | * Creates collector for remote cleanup |
||
71 | * |
||
72 | * @param Target $target |
||
73 | * @return Collector |
||
74 | */ |
||
75 | abstract protected function createCollector(Target $target): Collector; |
||
76 | |||
77 | /** |
||
78 | * Execute the remote clean up if needed |
||
79 | * |
||
80 | * @param \phpbu\App\Backup\Target $target |
||
81 | * @param \phpbu\App\Result $result |
||
82 | */ |
||
83 | 2 | public function cleanup(Target $target, Result $result) |
|
92 | |||
93 | /** |
||
94 | * Simulate remote cleanup. |
||
95 | * |
||
96 | * @param Target $target |
||
97 | * @param Result $result |
||
98 | */ |
||
99 | 6 | public function simulateRemoteCleanup(Target $target, Result $result) |
|
105 | } |
||
106 |