PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.8.1
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.8.1
5.8.0 5.8.1 5.7.0 5.6.2 5.6.3 5.6.1 5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 All 41 releases
double-opt-in / src / Service / ResendResult.php

ResendResult.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 5.8.1, at src/Service/ResendResult.php

57 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Outcome of re-sending a confirmation mail.
4 *
5 * @package Forge12\DoubleOptIn\Service
6 * @since 5.8.0
7 */
8
9 declare( strict_types=1 );
10
11 namespace Forge12\DoubleOptIn\Service;
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 /**
18 * Either sent, or the reason it was not. The reasons are stable strings so
19 * callers can phrase them for their own audience: the admin learns that a
20 * record is already confirmed, a visitor must never learn anything.
21 *
22 * @api
23 */
24 final class ResendResult {
25
26 public const SENT = 'sent';
27 public const NOT_FOUND = 'not_found';
28 public const CONFIRMED = 'confirmed';
29 public const OPTED_OUT = 'opted_out';
30 public const NO_BODY = 'no_body';
31 public const NO_RECIPIENT = 'no_recipient';
32 public const SEND_FAILED = 'send_failed';
33
34 /** @var string */
35 private $reason;
36
37 private function __construct( string $reason ) {
38 $this->reason = $reason;
39 }
40
41 public static function sent(): self {
42 return new self( self::SENT );
43 }
44
45 public static function refused( string $reason ): self {
46 return new self( $reason );
47 }
48
49 public function isSent(): bool {
50 return $this->reason === self::SENT;
51 }
52
53 public function getReason(): string {
54 return $this->reason;
55 }
56 }
57