Maileon PHP client  1.2.5
Easily integrate your PHP application with Maileon.
DataType.php
1 <?php
2 
12 {
13  public static $STRING;
14  public static $DOUBLE;
15  public static $FLOAT;
16  public static $INTEGER;
17  public static $BOOLEAN;
18  public static $TIMESTAMP;
19  public static $JSON;
20 
21  private static $initialized = false;
22 
23  // TODO use a more sensible name for this concept, e.g. "type descriptor"
30  public $value;
31 
32  static function init()
33  {
34  if (self::$initialized == false) {
35  self::$STRING = new com_maileon_api_transactions_DataType("string");
36  self::$DOUBLE = new com_maileon_api_transactions_DataType("double");
37  self::$FLOAT = new com_maileon_api_transactions_DataType("float");
38  self::$INTEGER = new com_maileon_api_transactions_DataType("integer");
39  self::$BOOLEAN = new com_maileon_api_transactions_DataType("boolean");
40  self::$TIMESTAMP = new com_maileon_api_transactions_DataType("timestamp");
41  self::$JSON = new com_maileon_api_transactions_DataType("json");
42  self::$initialized = true;
43  }
44  }
45 
53  function __construct($value)
54  {
55  $this->value = $value;
56  }
57 
63  function getValue()
64  {
65  return $this->value;
66  }
67 
77  static function getDataType($value)
78  {
79  switch ($value) {
80  case "string":
81  return self::$STRING;
82  case "double":
83  return self::$DOUBLE;
84  case "float":
85  return self::$FLOAT;
86  case "integer":
87  return self::$INTEGER;
88  case "boolean":
89  return self::$BOOLEAN;
90  case "timestamp":
91  return self::$TIMESTAMP;
92  case "json":
93  return self::$JSON;
94 
95  default:
96  return null;
97  }
98  }
99 }