1: <?php
2: namespace Ctct\Components\Activities;
3:
4: use Ctct\Components\Component;
5: use Ctct\Components\Contacts\Address;
6: use Ctct\Components\Contacts\CustomField;
7:
8: 9: 10: 11: 12: 13: 14:
15: class AddContactsImportData extends Component
16: {
17: public $first_name;
18: public $middle_name;
19: public $last_name;
20: public $job_title;
21: public $company_name;
22: public $work_phone;
23: public $home_phone;
24:
25: public $birthday_day;
26: public $birthday_month;
27: public $anniversary;
28:
29: public $email_addresses = array();
30: public $addresses = array();
31: public $custom_fields = array();
32:
33: 34: 35: 36:
37: public function __construct(array $props = array())
38: {
39: foreach ($this as $property => $value) {
40: $this->$property = parent::getValue($props, $property);
41: }
42: }
43:
44: public function addCustomField(CustomField $customField)
45: {
46: $this->custom_fields[] = $customField;
47: }
48:
49: public function addAddress(Address $address)
50: {
51: if (isset($address->state)) {
52: $address->state_code = $address->state;
53: unset($address->state);
54: }
55:
56: foreach ($address as $key => $value) {
57: if ($value == null) {
58: unset($address->$key);
59: }
60: }
61: $this->addresses[] = $address;
62: }
63:
64: public function addEmail($emailAddress)
65: {
66: $this->email_addresses[] = $emailAddress;
67: }
68:
69: public function toJson()
70: {
71: return json_encode($this);
72: }
73: }
74: