| Conditions | 3 |
| Paths | 13 |
| Total Lines | 26 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function handle() |
||
| 19 | { |
||
| 20 | consoleOutput()->comment('Starting cleanup...'); |
||
|
|
|||
| 21 | |||
| 22 | $disableNotifications = $this->option('disable-notifications'); |
||
| 23 | |||
| 24 | try { |
||
| 25 | $config = config('laravel-backup'); |
||
| 26 | |||
| 27 | $backupDestinations = BackupDestinationFactory::createFromArray($config['backup']); |
||
| 28 | |||
| 29 | $strategy = app($config['cleanup']['strategy']); |
||
| 30 | |||
| 31 | $cleanupJob = new CleanupJob($backupDestinations, $strategy, $disableNotifications); |
||
| 32 | |||
| 33 | $cleanupJob->run(); |
||
| 34 | |||
| 35 | consoleOutput()->comment('Cleanup completed!'); |
||
| 36 | } catch (Exception $exception) { |
||
| 37 | if (! $disableNotifications) { |
||
| 38 | event(new CleanupHasFailed($exception)); |
||
| 39 | } |
||
| 40 | |||
| 41 | return -1; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 45 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: