This repository was archived by the owner on Dec 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathAddContactsImportData.php
More file actions
73 lines (63 loc) · 1.82 KB
/
AddContactsImportData.php
File metadata and controls
73 lines (63 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace YousafSaqib\ConstantContact\Components\Activities;
use YousafSaqib\ConstantContact\Components\Component;
use YousafSaqib\ConstantContact\Components\Contacts\Address;
use YousafSaqib\ConstantContact\Components\Contacts\CustomField;
/**
* Represents a single Activity in Constant Contact
*
* @package Components
* @subpackage Activities
* @author Constant Contact
*/
class AddContactsImportData extends Component
{
public $first_name;
public $middle_name;
public $last_name;
public $job_title;
public $company_name;
public $work_phone;
public $home_phone;
public $birthday_day;
public $birthday_month;
public $anniversary;
public $email_addresses = array();
public $addresses = array();
public $custom_fields = array();
/**
* Factory method to create an Activity object from an array
* @param array $props - associative array of initial properties to set
*/
public function __construct(array $props = array())
{
foreach ($this as $property => $value) {
$this->$property = parent::getValue($props, $property);
}
}
public function addCustomField(CustomField $customField)
{
$this->custom_fields[] = $customField;
}
public function addAddress(Address $address)
{
if (isset($address->state)) {
$address->state_code = $address->state;
unset($address->state);
}
foreach ($address as $key => $value) {
if ($value == null) {
unset($address->$key);
}
}
$this->addresses[] = $address;
}
public function addEmail($emailAddress)
{
$this->email_addresses[] = $emailAddress;
}
public function toJson()
{
return json_encode($this);
}
}