| 1 |
<?php |
| 2 |
/** |
| 3 |
* OptIn Expired Event |
| 4 |
* |
| 5 |
* @package Forge12\DoubleOptIn\Events\Lifecycle |
| 6 |
* @since 4.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace Forge12\DoubleOptIn\Events\Lifecycle; |
| 10 |
|
| 11 |
use Forge12\DoubleOptIn\EventSystem\Event; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Class OptInExpiredEvent |
| 19 |
* |
| 20 |
* @api |
| 21 |
* |
| 22 |
* Dispatched when opt-in records are cleaned up by the cron job. |
| 23 |
* Covered by the Addon API semver policy as of Core API 4.3.0. |
| 24 |
*/ |
| 25 |
class OptInExpiredEvent extends Event { |
| 26 |
|
| 27 |
private string $cleanupType; |
| 28 |
private int $rowsDeleted; |
| 29 |
private \DateTimeImmutable $threshold; |
| 30 |
|
| 31 |
/** |
| 32 |
* Constructor. |
| 33 |
* |
| 34 |
* @param string $cleanupType The type: 'confirmed' or 'unconfirmed'. |
| 35 |
* @param int $rowsDeleted Number of records deleted. |
| 36 |
* @param \DateTimeImmutable $threshold The cutoff date/time. |
| 37 |
*/ |
| 38 |
public function __construct( |
| 39 |
string $cleanupType, |
| 40 |
int $rowsDeleted, |
| 41 |
\DateTimeImmutable $threshold |
| 42 |
) { |
| 43 |
parent::__construct(); |
| 44 |
$this->cleanupType = $cleanupType; |
| 45 |
$this->rowsDeleted = $rowsDeleted; |
| 46 |
$this->threshold = $threshold; |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* {@inheritdoc} |
| 51 |
*/ |
| 52 |
public static function getWordPressHookName(): string { |
| 53 |
return 'f12_cf7_doubleoptin_expired'; |
| 54 |
} |
| 55 |
|
| 56 |
public function getCleanupType(): string { |
| 57 |
return $this->cleanupType; |
| 58 |
} |
| 59 |
|
| 60 |
public function getRowsDeleted(): int { |
| 61 |
return $this->rowsDeleted; |
| 62 |
} |
| 63 |
|
| 64 |
public function getThreshold(): \DateTimeImmutable { |
| 65 |
return $this->threshold; |
| 66 |
} |
| 67 |
} |
| 68 |
|