| 1 |
<?php |
| 2 |
/** |
| 3 |
* Correlation data for one execution attempt. |
| 4 |
* |
| 5 |
* @package Forge12\DoubleOptIn\FollowUp |
| 6 |
* @since 5.6.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
declare( strict_types=1 ); |
| 10 |
|
| 11 |
namespace Forge12\DoubleOptIn\FollowUp; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* One attempt groups the actions claimed together in a single run. |
| 19 |
* |
| 20 |
* The attempt id is for correlation only (logs, audit, replay ticket). |
| 21 |
* It is NOT the idempotency key — that is (opt-in id, action id). |
| 22 |
*/ |
| 23 |
final class FollowUpAttempt { |
| 24 |
|
| 25 |
public const TRIGGER_CONFIRM = 'confirm'; |
| 26 |
public const TRIGGER_CRON = 'cron'; |
| 27 |
public const TRIGGER_MANUAL = 'manual'; |
| 28 |
public const TRIGGER_LEGACY = 'legacy_hook'; |
| 29 |
|
| 30 |
/** @var string */ |
| 31 |
private $id; |
| 32 |
|
| 33 |
/** @var string */ |
| 34 |
private $trigger; |
| 35 |
|
| 36 |
/** @var int */ |
| 37 |
private $optInId; |
| 38 |
|
| 39 |
public function __construct( string $id, string $trigger, int $optInId ) { |
| 40 |
$this->id = $id; |
| 41 |
$this->trigger = $trigger; |
| 42 |
$this->optInId = $optInId; |
| 43 |
} |
| 44 |
|
| 45 |
public function getId(): string { |
| 46 |
return $this->id; |
| 47 |
} |
| 48 |
|
| 49 |
public function getTrigger(): string { |
| 50 |
return $this->trigger; |
| 51 |
} |
| 52 |
|
| 53 |
public function getOptInId(): int { |
| 54 |
return $this->optInId; |
| 55 |
} |
| 56 |
} |
| 57 |
|