1 | <?php |
||
10 | abstract class CheckDefinition |
||
11 | { |
||
12 | /** @var \Spatie\ServerMonitor\Models\Check */ |
||
13 | protected $check; |
||
14 | |||
15 | /** |
||
16 | * @param \Spatie\ServerMonitor\Models\Check $check |
||
17 | * |
||
18 | * @return $this |
||
19 | */ |
||
20 | public function setCheck(Check $check) |
||
26 | |||
27 | public function command(): string |
||
28 | { |
||
29 | return $this->command; |
||
|
|||
30 | } |
||
31 | |||
32 | public function handleFinishedProcess(Process $process) |
||
48 | |||
49 | abstract public function handleSuccessfulProcess(Process $process); |
||
50 | |||
51 | public function handleFailedProcess(Process $process) |
||
55 | |||
56 | /** |
||
57 | * When a check is emitting a warning or is failing, a notification will only |
||
58 | * be sent once in given amount of minutes. |
||
59 | * |
||
60 | * @return int |
||
61 | */ |
||
62 | public function throttleFailingNotificationsForMinutes(): int |
||
66 | |||
67 | public function performNextRunInMinutes(): int |
||
75 | |||
76 | /** |
||
77 | * The amount of seconds that check may run. |
||
78 | * |
||
79 | * @return int |
||
80 | */ |
||
81 | public function timeoutInSeconds(): int |
||
85 | } |
||
86 |
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: