39 if (
$value instanceof \StdClass) {
45 foreach (
$value as $k => $v) {
51 if (strpos($v,
',') !==
false) {
52 $v = explode(
',', $v);
54 if (strcmp($k,
'until') === 0) {
55 $v = strtr($v, [
':' =>
'',
'-' =>
'']);
57 } elseif (is_array($v)) {
58 $v = array_map(
'strtoupper', $v);
61 $newVal[strtoupper($k)] = $v;
63 $this->value = $newVal;
64 } elseif (is_string(
$value)) {
65 $this->value = self::stringToArray(
$value);
67 throw new \InvalidArgumentException(
'You must either pass a string, or a key=>value array');
89 return strtoupper(implode(
';',
$out));
170 foreach ($this->
getParts() as $k => $v) {
171 if (strcmp($k,
'UNTIL') === 0) {
172 $date =
new DateTime($this->root, null, $v);
173 $values[strtolower($k)] = $date->getJsonValue()[0];
174 } elseif (strcmp($k,
'COUNT') === 0) {
175 $values[strtolower($k)] = intval($v);
197 $writer->writeElement($valueType, $value);
213 foreach (explode(
';',
$value) as $part) {
219 list($partName, $partValue) = explode(
'=', $part);
222 if (strpos($partValue,
',') !==
false) {
223 $partValue = explode(
',', $partValue);
225 $newValue[$partName] = $partValue;
256 $repair = (
$options & self::REPAIR);
265 'level' => $repair ? 1 : 3,
272 } elseif (
$key ==
'BYMONTH') {
274 foreach ($byMonth as
$i => $v) {
275 if (!is_numeric($v) || (int)$v < 1 || (
int)$v > 12) {
277 'level' => $repair ? 1 : 3,
278 'message' =>
'BYMONTH in RRULE must have value(s) between 1 and 12!',
294 } elseif (
$key ==
'BYWEEKNO') {
295 $byWeekNo = (array)
$value;
296 foreach ($byWeekNo as
$i => $v) {
297 if (!is_numeric($v) || (int)$v < -53 || (
int)$v == 0 || (int)$v > 53) {
299 'level' => $repair ? 1 : 3,
300 'message' =>
'BYWEEKNO in RRULE must have value(s) from -53 to -1, or 1 to 53!',
316 } elseif (
$key ==
'BYYEARDAY') {
317 $byYearDay = (array)
$value;
318 foreach ($byYearDay as
$i => $v) {
319 if (!is_numeric($v) || (int)$v < -366 || (
int)$v == 0 || (int)$v > 366) {
321 'level' => $repair ? 1 : 3,
322 'message' =>
'BYYEARDAY in RRULE must have value(s) from -366 to -1, or 1 to 366!',
343 'level' => $repair ? 1 : 3,
348 $this->
parent->remove($this);
getValue()
Returns the current value.
getParts()
Returns a multi-valued property.
setParts(array $parts)
Sets a multi-valued property.
getRawMimeDirValue()
Returns a raw mime-dir representation of the value.
static stringToArray($value)
Parses an RRULE value string, and turns it into a struct-ish array.
setValue($value)
Updates the current value.
xmlSerializeValue(Xml\Writer $writer)
This method serializes only the value of a property.
getValueType()
Returns the type of value.
setRawMimeDirValue($val)
Sets a raw value coming from a mimedir (iCalendar/vCard) file.
getJsonValue()
Returns the value, in the format it should be encoded for json.
validate($options=0)
Validates the node for correctness.