ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Binary.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
21 class Binary extends Property {
22 
29  public $delimiter = null;
30 
40  function setValue($value) {
41 
42  if (is_array($value)) {
43 
44  if (count($value) === 1) {
45  $this->value = $value[0];
46  } else {
47  throw new \InvalidArgumentException('The argument must either be a string or an array with only one child');
48  }
49 
50  } else {
51 
52  $this->value = $value;
53 
54  }
55 
56  }
57 
68  function setRawMimeDirValue($val) {
69 
70  $this->value = base64_decode($val);
71 
72  }
73 
79  function getRawMimeDirValue() {
80 
81  return base64_encode($this->value);
82 
83  }
84 
93  function getValueType() {
94 
95  return 'BINARY';
96 
97  }
98 
106  function getJsonValue() {
107 
108  return [base64_encode($this->getValue())];
109 
110  }
111 
121  function setJsonValue(array $value) {
122 
123  $value = array_map('base64_decode', $value);
124  parent::setJsonValue($value);
125 
126  }
127 
128 }
getRawMimeDirValue()
Returns a raw mime-dir representation of the value.
Definition: Binary.php:79
setJsonValue(array $value)
Sets the json value, as it would appear in a jCard or jCal object.
Definition: Binary.php:121
setValue($value)
Updates the current value.
Definition: Binary.php:40
getJsonValue()
Returns the value, in the format it should be encoded for json.
Definition: Binary.php:106
BINARY property.
Definition: Binary.php:21
setRawMimeDirValue($val)
Sets a raw value coming from a mimedir (iCalendar/vCard) file.
Definition: Binary.php:68
count()
Returns the number of elements.
Definition: Node.php:177
getValue()
Returns the current value.
Definition: Property.php:115
getValueType()
Returns the type of value.
Definition: Binary.php:93