Maileon PHP client  1.5.5
Easily integrate your PHP application with Maileon.
Permission.php
1 <?php
2 
9 {
10 
11  public static $NONE;
12  public static $SOI;
13  public static $COI;
14  public static $DOI;
15  public static $DOI_PLUS;
16  public static $OTHER;
17  private static $initialized = false;
18 
19  public $code;
20  public $type;
21 
25  static function init()
26  {
27  if (self::$initialized == false) {
28  self::$NONE = new com_maileon_api_contacts_Permission(1, "none");
29  self::$SOI = new com_maileon_api_contacts_Permission(2, "soi");
30  self::$COI = new com_maileon_api_contacts_Permission(3, "coi");
31  self::$DOI = new com_maileon_api_contacts_Permission(4, "doi");
32  self::$DOI_PLUS = new com_maileon_api_contacts_Permission(5, "doi+");
33  self::$OTHER = new com_maileon_api_contacts_Permission(6, "other");
34  self::$initialized = true;
35  }
36  }
37 
44  function __construct($code = 0, $type = null)
45  {
46  $this->code = $code < 1 || $code > 6 ? 6 : $code;
47  if($type === null) {
48  $this->type = $this->getType($code);
49  } else {
50  $this->type = $type;
51  }
52  }
53 
61  function getCode()
62  {
63  return $this->code;
64  }
65 
73  function getString()
74  {
75  return $this->type;
76  }
77 
78  private function getType($code) {
79  switch ($code) {
80  case 1:
81  return 'none';
82  case 2:
83  return 'soi';
84  case 3:
85  return 'coi';
86  case 4:
87  return 'doi';
88  case 5:
89  return 'doi+';
90  case 6:
91  return 'other';
92  default:
93  return 'other';
94  }
95  }
96 
105  static function getPermission($code)
106  {
107  switch ($code) {
108  case 1:
109  return self::$NONE;
110  case "none":
111  return self::$NONE;
112  case 2:
113  return self::$SOI;
114  case "soi":
115  return self::$SOI;
116  case 3:
117  return self::$COI;
118  case "coi":
119  return self::$COI;
120  case 4:
121  return self::$DOI;
122  case "doi":
123  return self::$DOI;
124  case 5:
125  return self::$DOI_PLUS;
126  case "doi+":
127  return self::$DOI_PLUS;
128  case 6:
129  return self::$OTHER;
130  case "other":
131  return self::$OTHER;
132 
133  default:
134  return self::$OTHER;
135  }
136  }
137 
138 }
__construct($code=0, $type=null)
Definition: Permission.php:44