_id = (int) $data->id; $this->_name = $data->name; $this->_contacts = array(); foreach ($data->contacts as $contact) { $this->_contacts[] = $contact->id; } } /** * Returns the identifier for the group. * * @return int */ public function getId() { return $this->_id; } /** * Returns the name of the group. * * @return string */ public function getName() { return $this->_name; } /** * Returns a list of identifiers for contacts in the group. * * @return array */ public function getContacts() { return $this->_contacts; } /** * Returns whether or not the group contains a specified contact. * * @param int $contact Identifier for the contact * @return bool TRUE if the group contains the contact, FALSE otherwise */ public function hasContact($contact) { return in_array($contact, $this->_contacts); } }