1 | <?php |
||
24 | class Capacity extends Abstraction implements Simulator |
||
25 | { |
||
26 | /** |
||
27 | * Original XML value |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $capacityRaw; |
||
32 | |||
33 | /** |
||
34 | * Capacity in bytes. |
||
35 | * |
||
36 | * @var mixed <integer|double> |
||
37 | */ |
||
38 | protected $capacityBytes; |
||
39 | |||
40 | /** |
||
41 | * Delete current backup as well |
||
42 | * |
||
43 | * @var bool |
||
44 | */ |
||
45 | protected $deleteTarget; |
||
46 | |||
47 | /** |
||
48 | * Setup the the Cleaner. |
||
49 | * |
||
50 | * @see \phpbu\App\Backup\Cleanup::setup() |
||
51 | * @param array $options |
||
52 | * @throws \phpbu\App\Backup\Cleaner\Exception |
||
53 | */ |
||
54 | 9 | public function setup(array $options) |
|
68 | |||
69 | /** |
||
70 | * Simulate the cleanup execution. |
||
71 | * |
||
72 | * @param \phpbu\App\Backup\Target $target |
||
73 | * @param \phpbu\App\Backup\Collector $collector |
||
74 | * @param \phpbu\App\Result $result |
||
75 | */ |
||
76 | 2 | public function simulate(Target $target, Collector $collector, Result $result) |
|
91 | |||
92 | /** |
||
93 | * Return list of files to delete. |
||
94 | * |
||
95 | * @param \phpbu\App\Backup\Target $target |
||
96 | * @param \phpbu\App\Backup\Collector $collector |
||
97 | * @return \phpbu\App\Backup\File\Local[] |
||
98 | * @throws \phpbu\App\Exception |
||
99 | */ |
||
100 | 6 | protected function getFilesToDelete(Target $target, Collector $collector) |
|
127 | |||
128 | /** |
||
129 | * Return a list of all deletable backups, including the currently created one if configured. |
||
130 | * |
||
131 | * @param \phpbu\App\Backup\Target $target |
||
132 | * @param \phpbu\App\Backup\Collector $collector |
||
133 | * @return \phpbu\App\Backup\File\Local[] |
||
134 | */ |
||
135 | 6 | protected function getDeletableBackups(Target $target, Collector $collector): array |
|
146 | |||
147 | /** |
||
148 | * Is a given size bigger than the configured capacity limit. |
||
149 | * |
||
150 | * @param int|double $currentCapacity |
||
151 | * @return bool |
||
152 | */ |
||
153 | 6 | protected function isCapacityExceeded($currentCapacity): bool |
|
157 | } |
||
158 |