| @@ 48-60 (lines=13) @@ | ||
| 45 | * @param array $options |
|
| 46 | * @throws \phpbu\App\Backup\Cleaner\Exception |
|
| 47 | */ |
|
| 48 | public function setup(array $options) |
|
| 49 | { |
|
| 50 | if (!isset($options['size'])) { |
|
| 51 | throw new Exception('option \'size\' is missing'); |
|
| 52 | } |
|
| 53 | try { |
|
| 54 | $bytes = Str::toBytes($options['size']); |
|
| 55 | } catch (RuntimeException $e) { |
|
| 56 | throw new Exception($e->getMessage()); |
|
| 57 | } |
|
| 58 | $this->capacityRaw = $options['size']; |
|
| 59 | $this->capacityBytes = $bytes; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Return list of files to delete. |
|
| @@ 45-57 (lines=13) @@ | ||
| 42 | * @param array $options |
|
| 43 | * @throws \phpbu\App\Backup\Cleaner\Exception |
|
| 44 | */ |
|
| 45 | public function setup(array $options) |
|
| 46 | { |
|
| 47 | if (!isset($options['older'])) { |
|
| 48 | throw new Exception('option \'older\' is missing'); |
|
| 49 | } |
|
| 50 | try { |
|
| 51 | $seconds = Str::toTime($options['older']); |
|
| 52 | } catch (RuntimeException $e) { |
|
| 53 | throw new Exception($e->getMessage()); |
|
| 54 | } |
|
| 55 | $this->offsetRaw = $options['older']; |
|
| 56 | $this->offsetSeconds = $seconds; |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Return list of files to delete. |
|