| 1 |
<?php |
| 2 |
/** |
| 3 |
* Abstract base class for free-version report stubs. |
| 4 |
* |
| 5 |
* @package WP_Defender\Model\Notification |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WP_Defender\Model\Notification; |
| 9 |
|
| 10 |
/** |
| 11 |
* Abstract base class for free-version report stubs. |
| 12 |
*/ |
| 13 |
abstract class Free_Report extends \WP_Defender\Model\Notification { |
| 14 |
|
| 15 |
/** |
| 16 |
* Returns the default fields shared by all report notifications. |
| 17 |
* |
| 18 |
* @return array |
| 19 |
*/ |
| 20 |
protected function base_defaults(): array { |
| 21 |
return array( |
| 22 |
'status' => self::STATUS_DISABLED, |
| 23 |
'in_house_recipients' => array(), |
| 24 |
'out_house_recipients' => array(), |
| 25 |
'type' => 'report', |
| 26 |
'frequency' => 'weekly', |
| 27 |
'day' => 'sunday', |
| 28 |
'day_n' => 1, |
| 29 |
'time' => '4:00', |
| 30 |
'dry_run' => false, |
| 31 |
'configs' => array(), |
| 32 |
); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Never dispatches a report in the free version. |
| 37 |
* |
| 38 |
* @return bool Always false. |
| 39 |
*/ |
| 40 |
public function maybe_send(): bool { |
| 41 |
return false; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* No-op: report sending is a Pro-only feature. |
| 46 |
*/ |
| 47 |
public function send(): void {} |
| 48 |
|
| 49 |
/** |
| 50 |
* Additional converting rules. |
| 51 |
* |
| 52 |
* @param array $configs The configuration data. |
| 53 |
* |
| 54 |
* @return array The type-casted configuration data. |
| 55 |
*/ |
| 56 |
public function type_casting( $configs ): array { |
| 57 |
return is_array( $configs ) ? $configs : array(); |
| 58 |
} |
| 59 |
} |
| 60 |
|