1 | <?php |
||
9 | class Notifier |
||
10 | { |
||
11 | /** @var array */ |
||
12 | protected $config; |
||
13 | |||
14 | public function __construct() |
||
18 | |||
19 | public function backupWasSuccessful() |
||
28 | |||
29 | public function backupHasFailed(Exception $exception, BackupDestination $backupDestination = null) |
||
40 | |||
41 | public function cleanupWasSuccessFul(BackupDestination $backupDestination) |
||
50 | |||
51 | public function cleanupHasFailed(Exception $exception) |
||
60 | |||
61 | public function healthyBackupWasFound(BackupDestinationStatus $backupDestinationStatus) |
||
70 | |||
71 | /** |
||
72 | * @param \Spatie\Backup\Tasks\Monitor\BackupDestinationStatus $backupDestinationStatus |
||
73 | */ |
||
74 | public function unhealthyBackupWasFound(BackupDestinationStatus $backupDestinationStatus) |
||
75 | { |
||
76 | $this->sendNotification( |
||
77 | 'whenUnhealthyBackupWasFound', |
||
78 | "Unhealthy backup found for {$backupDestinationStatus->getBackupName()} on {$backupDestinationStatus->getFilesystemName()}-filesystem", |
||
79 | UnhealthyBackupMessage::createForBackupDestinationStatus($backupDestinationStatus), |
||
80 | BaseSender::TYPE_ERROR |
||
81 | ); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @param string $eventName |
||
86 | * @param string $subject |
||
87 | * @param string $message |
||
88 | * @param string $type |
||
89 | */ |
||
90 | protected function sendNotification($eventName, $subject, $message, $type) |
||
112 | } |
||
113 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: