Maileon PHP client  1.5.0
Easily integrate your PHP application with Maileon.
DataType.php
1 <?php
2 
11 {
12  public static $STRING;
13  public static $DOUBLE;
14  public static $FLOAT;
15  public static $INTEGER;
16  public static $BOOLEAN;
17  public static $TIMESTAMP;
18 
19  private static $initialized = false;
20 
21  // TODO use a more sensible name for this concept, e.g. "type descriptor"
28  public $value;
29 
30  static function init()
31  {
32  if (self::$initialized == false) {
33  self::$STRING = new com_maileon_api_contactevents_DataType("string");
34  self::$DOUBLE = new com_maileon_api_contactevents_DataType("double");
35  self::$FLOAT = new com_maileon_api_contactevents_DataType("float");
36  self::$INTEGER = new com_maileon_api_contactevents_DataType("integer");
37  self::$BOOLEAN = new com_maileon_api_contactevents_DataType("boolean");
38  self::$TIMESTAMP = new com_maileon_api_contactevents_DataType("timestamp");
39  self::$initialized = true;
40  }
41  }
42 
50  function __construct($value)
51  {
52  $this->value = $value;
53  }
54 
60  function getValue()
61  {
62  return $this->value;
63  }
64 
74  static function getDataType($value)
75  {
76  switch ($value) {
77  case "string":
78  return self::$STRING;
79  case "double":
80  return self::$DOUBLE;
81  case "float":
82  return self::$FLOAT;
83  case "integer":
84  return self::$INTEGER;
85  case "boolean":
86  return self::$BOOLEAN;
87  case "timestamp":
88  return self::$TIMESTAMP;
89 
90  default:
91  return null;
92  }
93  }
94 }