/** * parse a json calendar * @param array &$data * @param string $key * @param mixed $value */ protected function setProperty(&$data, $key, $value) { switch ($key) { case 'backend': case 'color': case 'description': case 'displayname': case 'timezone': $data[$key] = strval($value); break; case 'uri': $data['publicUri'] = strval($value); break; case 'order': $data[$key] = intval($value); break; case 'enabled': $data[$key] = (bool) $value; //boolval is PHP >= 5.5 only break; case 'components': $data[$key] = JSONUtility::parseComponents($value); break; //blacklist: //blacklist: case 'cruds': case 'ctag': case 'user': case 'owner': break; default: break; } }
/** * @param array &$data * @param string $key * @param mixed $value */ public function setProperty(array &$data, $key, $value) { switch ($key) { case 'backend': case 'color': case 'description': case 'displayname': $data[$key] = strval($value); break; case 'timezone': $data[$key] = $value instanceof ITimezone ? $value->getTzId() : null; break; case 'publicuri': $data['uri'] = strval($value); break; case 'ctag': case 'id': case 'order': $data[$key] = intval($value); break; case 'enabled': $data[$key] = (bool) $value; //boolval is PHP >= 5.5 only break; case 'components': $data[$key] = JSONUtility::getComponents($value); break; case 'cruds': $data[$key] = JSONUtility::getCruds($value); break; case 'ownerid': case 'userid': $key = substr($key, 0, -2); $data[$key] = JSONUtility::getUserInformation($value); break; case 'lastpropertiesupdate': case 'lastobjectupdate': case 'privateuri': case 'fileid': break; default: $data[$key] = $value; break; } }