1: <?php
2: namespace Ctct\Components\Contacts;
3:
4: use Ctct\Components\Component;
5:
6: /**
7: * Represents a single Address of a Contact
8: *
9: * @package Components
10: * @subpackage Contacts
11: * @author Constant Contact
12: */
13: class Address extends Component
14: {
15: /**
16: * Line 1 of the address
17: * @var string
18: */
19: public $line1;
20:
21: /**
22: * Line 2 of the address
23: * @var string
24: */
25: public $line2;
26:
27: /**
28: * Line 3 of the address
29: * @var string
30: */
31: public $line3;
32:
33: /**
34: * City info for this address
35: * @var string
36: */
37: public $city;
38:
39: /**
40: * Address type, must be one of "BUSINESS", "PERSONAL", or "UNKNOWN"
41: * @var string
42: */
43: public $address_type;
44:
45: /**
46: * The state code for this address
47: * @var string
48: */
49: public $state_code;
50:
51: /**
52: * The country code for this address
53: * @var string
54: */
55: public $country_code;
56:
57: /**
58: * The postal code for this address
59: * @var string
60: */
61: public $postal_code;
62:
63: /**
64: * The sub postal code for this address
65: * @var string
66: */
67: public $sub_postal_code;
68:
69: /**
70: * Factory method to create an Address object from an array
71: * @array $props - Associative array of initial properties to set
72: * @return Address
73: */
74: public static function create(array $props)
75: {
76: $address = new Address();
77: $address->line1 = parent::getValue($props, "line1");
78: $address->line2 = parent::getValue($props, "line2");
79: $address->line3 = parent::getValue($props, "line3");
80: $address->city = parent::getValue($props, "city");
81: $address->address_type = parent::getValue($props, "address_type");
82: $address->state_code = parent::getValue($props, "state_code");
83: $address->country_code = parent::getValue($props, "country_code");
84: $address->postal_code = parent::getValue($props, "postal_code");
85: $address->sub_postal_code = parent::getValue($props, "sub_postal_code");
86: return $address;
87: }
88: }
89: