1: <?php
2: namespace Ctct\Components\Contacts;
3:
4: use Ctct\Components\Component;
5:
6: /**
7: * Represents a single EmailAddress of a Contact
8: *
9: * @package Components
10: * @subpackage Contacts
11: * @author Constant Contact
12: */
13: class EmailAddress extends Component
14: {
15: /**
16: * Status of the email address, must be one of "ACTIVE", "UNCONFIRMED", "OPTOUT", "REMOVED",
17: * "NON_SUBSCRIBER", "VISITOR"
18: * @var string
19: */
20: public $status;
21:
22: /**
23: * Contact's confirmation status, must be one of "CONFIRMED", "NO_CONFIRMATION_REQUIRED", "UNCONFIRMED"
24: * @var string
25: */
26: public $confirm_status;
27:
28: /**
29: * Contact's opt in source, must be one of "ACTION_BY_VISITOR", "ACTION_BY_OWNER"
30: * @var string
31: */
32: public $opt_in_source;
33:
34: /**
35: * Contact's opt in date in ISO 8601 format
36: * @var string
37: */
38: public $opt_in_date;
39:
40: /**
41: * Contact's opt out date in ISO 8601 format
42: * @var string
43: */
44: public $opt_out_date;
45:
46: /**
47: * Email address associated with the contact
48: * @var string
49: */
50: public $email_address;
51:
52: public function __construct($email_address = null)
53: {
54: if (!is_null($email_address)) {
55: $this->email_address = $email_address;
56: }
57:
58: return $this;
59: }
60:
61: /**
62: * Factory method to create an EmailAddress object from an array
63: * @param array $props - Associative array of initial properties to set
64: * @return EmailAddress
65: */
66: public static function create(array $props)
67: {
68: $email_address = new EmailAddress();
69: $email_address->status = parent::getValue($props, "status");
70: $email_address->confirm_status = parent::getValue($props, "confirm_status");
71: $email_address->opt_in_source = parent::getValue($props, "opt_in_source");
72: $email_address->opt_in_date = parent::getValue($props, "opt_in_date");
73: $email_address->opt_out_date = parent::getValue($props, "opt_out_date");
74: $email_address->email_address = parent::getValue($props, "email_address");
75: return $email_address;
76: }
77: }
78: