1: <?php
2: namespace Ctct\Components\Contacts;
3:
4: use Ctct\Components\Component;
5:
6: /**
7: * Represents a single Contact List
8: *
9: * @package Components
10: * @subpackage Contacts
11: * @author Constant Contact
12: */
13: class ContactList extends Component
14: {
15: /**
16: * Unique identifier of the contact list
17: * @var string
18: */
19: public $id;
20:
21: /**
22: * Name of the contact list
23: * @var string
24: */
25: public $name;
26:
27: /**
28: * Status of the contact list, must be one of "ACTIVE", "HIDDEN", "REMOVED"
29: * @var string
30: */
31: public $status;
32:
33: /**
34: * The number of contacts in the list
35: * @var string
36: */
37: public $contact_count;
38:
39: public function __construct($list_id = null)
40: {
41: if (!is_null($list_id)) {
42: $this->id = $list_id;
43: }
44:
45: return $this;
46: }
47:
48: /**
49: * Factory method to create a ContactList object from an array
50: * @param array $props - Associative array of initial properties to set
51: * @return ContactList
52: */
53: public static function create(array $props)
54: {
55: $contact_list = new ContactList();
56: $contact_list->id = parent::getValue($props, "id");
57: $contact_list->name = parent::getValue($props, "name");
58: $contact_list->status = parent::getValue($props, "status");
59: $contact_list->contact_count = parent::getValue($props, "contact_count");
60: return $contact_list;
61: }
62:
63: public function toJson()
64: {
65: return json_encode($this);
66: }
67: }
68: