-
Notifications
You must be signed in to change notification settings - Fork 8
/
DynamicsCRM2011_OptionSetValue.class.php
52 lines (46 loc) · 1.19 KB
/
DynamicsCRM2011_OptionSetValue.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require_once 'DynamicsCRM2011.php';
class DynamicsCRM2011_OptionSetValue extends DynamicsCRM2011 {
/* Value */
protected $value = NULL;
/* Label */
protected $label = NULL;
/**
* Create a new OptionSetValue
*
* @param int $_value the Value of the Option
* @param String $_label the Label of the Option
*/
public function __construct($_value, $_label) {
/* Store the details */
$this->value = $_value;
$this->label = $_label;
}
/**
* Handle the retrieval of properties
*
* @param String $name
*/
public function __get($property) {
/* Allow case-insensitive fields */
switch (strtolower($property)) {
case 'value':
return $this->value;
break;
case 'label':
return $this->label;
}
/* Property doesn't exist - standard error */
$trace = debug_backtrace();
trigger_error('Undefined property via __get(): ' . $property
. ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'],
E_USER_NOTICE);
return NULL;
}
/**
* @return String description of the OptionSetValue including Value and Label
*/
public function __toString() {
return '['.$this->value.'] '.$this->label;
}
}