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 | public function setup(array $options) |
||
69 | 5 | ||
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 | public function simulate(Target $target, Collector $collector, Result $result) |
||
83 | 4 | ||
84 | /** |
||
85 | * Return list of files to delete. |
||
86 | 4 | * |
|
87 | 4 | * @param \phpbu\App\Backup\Target $target |
|
88 | 4 | * @param \phpbu\App\Backup\Collector $collector |
|
89 | * @return \phpbu\App\Backup\File[] |
||
90 | * @throws \phpbu\App\Exception |
||
91 | 4 | */ |
|
92 | protected function getFilesToDelete(Target $target, Collector $collector) |
||
119 | |||
120 | /** |
||
121 | * Return a list of all deletable backups, including the currently created one if configured. |
||
122 | * |
||
123 | * @param \phpbu\App\Backup\Target $target |
||
124 | * @param \phpbu\App\Backup\Collector $collector |
||
125 | * @return \phpbu\App\Backup\File[] |
||
126 | */ |
||
127 | protected function getDeletableBackups(Target $target, Collector $collector) : array |
||
138 | |||
139 | /** |
||
140 | * Is a given size bigger than the configured capacity limit. |
||
141 | * |
||
142 | * @param int|double $currentCapacity |
||
143 | * @return bool |
||
144 | */ |
||
145 | protected function isCapacityExceeded($currentCapacity) : bool |
||
149 | } |
||
150 |