Maileon PHP client  1.5.5
Easily integrate your PHP application with Maileon.
ContactEventList.php
1 <?php
2 
9 {
10  public $token;
11  public $events;
12 
16  function __construct()
17  {
18  $this->events = array();
19  }
20 
27  function addEvent($event)
28  {
29  array_push($this->events, $event);
30  }
31 
37  function fromXML($xmlElement)
38  {
39  }
40 
45  function toXML()
46  {
47  $xml = new SimpleXMLElement("<?xml version=\"1.0\"?><events></events>");
48 
49  // Some fields are mandatory, especially when setting data to the API
50  if (isset($this->token)) $xml->addChild("token", $this->token);
51 
52 
53  if (count($this->events)) {
54  foreach ($this->events as $event) {
55  com_maileon_api_xml_XMLUtils::appendChild($xml, $event->toXML());
56  }
57  }
58 
59  return $xml;
60  }
61 
66  function toXMLString()
67  {
68  $xml = $this->toXML();
69  return $xml->asXML();
70  }
71 
76  function toString()
77  {
78 
79  // Generate standard field string
80  $events = "";
81  if (array_count_values($this->events) > 0) {
82  foreach ($this->events as $event) {
83  $events .= $event->toString() . ",";
84  }
85  $events = rtrim($events, ',');
86  }
87 
88  return "ContactEventList [token=" . $this->token . ", events={" . $events . "}]";
89  }
90 }
static appendChild(SimpleXMLElement $to, SimpleXMLElement $from)
Definition: XMLUtils.php:18