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: /**
17: * Id of the email address
18: * @var string
19: */
20: public $id;
21:
22: /**
23: * Status of the email address, must be one of "ACTIVE", "UNCONFIRMED", "OPTOUT", "REMOVED",
24: * "NON_SUBSCRIBER", "VISITOR"
25: * @var string
26: */
27: public $status;
28:
29: /**
30: * Contact's confirmation status, must be one of "CONFIRMED", "NO_CONFIRMATION_REQUIRED", "UNCONFIRMED"
31: * @var string
32: */
33: public $confirm_status;
34:
35: /**
36: * Contact's opt in source, must be one of "ACTION_BY_VISITOR", "ACTION_BY_OWNER"
37: * @var string
38: */
39: public $opt_in_source;
40:
41: /**
42: * Contact's opt in date in ISO 8601 format
43: * @var string
44: */
45: public $opt_in_date;
46:
47: /**
48: * Contact's opt out date in ISO 8601 format
49: * @var string
50: */
51: public $opt_out_date;
52:
53: /**
54: * Email address associated with the contact
55: * @var string
56: */
57: public $email_address;
58:
59: public function __construct($email_address = null)
60: {
61: if (!is_null($email_address)) {
62: $this->email_address = $email_address;
63: }
64:
65: return $this;
66: }
67:
68: /**
69: * Factory method to create an EmailAddress object from an array
70: * @param array $props - Associative array of initial properties to set
71: * @return EmailAddress
72: */
73: public static function create(array $props)
74: {
75: $email_address = new EmailAddress();
76: $email_address->id = parent::getValue($props, "id");
77: $email_address->status = parent::getValue($props, "status");
78: $email_address->confirm_status = parent::getValue($props, "confirm_status");
79: $email_address->opt_in_source = parent::getValue($props, "opt_in_source");
80: $email_address->opt_in_date = parent::getValue($props, "opt_in_date");
81: $email_address->opt_out_date = parent::getValue($props, "opt_out_date");
82: $email_address->email_address = parent::getValue($props, "email_address");
83: return $email_address;
84: }
85: }
86: