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