Merge pull request #11771 from Quix0r/fixes/marcor-newapi
Rewrote to almost one block of array initialization
This commit is contained in:
commit
3523ec1717
|
@ -243,27 +243,31 @@ class Event
|
||||||
*/
|
*/
|
||||||
public static function store(array $arr): int
|
public static function store(array $arr): int
|
||||||
{
|
{
|
||||||
$event = [];
|
$guid = $arr['guid'] ?? '' ?: System::createUUID();
|
||||||
$event['id'] = intval($arr['id'] ?? 0);
|
$uri = $arr['uri'] ?? '' ?: Item::newURI($guid);
|
||||||
$event['uid'] = intval($arr['uid'] ?? 0);
|
$event = [
|
||||||
$event['cid'] = intval($arr['cid'] ?? 0);
|
'id' => intval($arr['id'] ?? 0),
|
||||||
$event['guid'] = ($arr['guid'] ?? '') ?: System::createUUID();
|
'uid' => intval($arr['uid'] ?? 0),
|
||||||
$event['uri'] = ($arr['uri'] ?? '') ?: Item::newURI($event['guid']);
|
'cid' => intval($arr['cid'] ?? 0),
|
||||||
$event['uri-id'] = ItemURI::insert(['uri' => $event['uri'], 'guid' => $event['guid']]);
|
'guid' => $guid,
|
||||||
$event['type'] = ($arr['type'] ?? '') ?: 'event';
|
'uri' => $uri,
|
||||||
$event['summary'] = $arr['summary'] ?? '';
|
'uri-id' => ItemURI::insert(['uri' => $uri, 'guid' => $guid]),
|
||||||
$event['desc'] = $arr['desc'] ?? '';
|
'type' => ($arr['type'] ?? '') ?: 'event',
|
||||||
$event['location'] = $arr['location'] ?? '';
|
'summary' => $arr['summary'] ?? '',
|
||||||
$event['allow_cid'] = $arr['allow_cid'] ?? '';
|
'desc' => $arr['desc'] ?? '',
|
||||||
$event['allow_gid'] = $arr['allow_gid'] ?? '';
|
'location' => $arr['location'] ?? '',
|
||||||
$event['deny_cid'] = $arr['deny_cid'] ?? '';
|
'allow_cid' => $arr['allow_cid'] ?? '',
|
||||||
$event['deny_gid'] = $arr['deny_gid'] ?? '';
|
'allow_gid' => $arr['allow_gid'] ?? '',
|
||||||
$event['nofinish'] = intval($arr['nofinish'] ?? (!empty($event['start']) && empty($event['finish'])));
|
'deny_cid' => $arr['deny_cid'] ?? '',
|
||||||
|
'deny_gid' => $arr['deny_gid'] ?? '',
|
||||||
|
'nofinish' => intval($arr['nofinish'] ?? (!empty($arr['start']) && empty($arr['finish']))),
|
||||||
|
'created' => DateTimeFormat::utc(($arr['created'] ?? '') ?: 'now'),
|
||||||
|
'edited' => DateTimeFormat::utc(($arr['edited'] ?? '') ?: 'now'),
|
||||||
|
'start' => DateTimeFormat::utc(($arr['start'] ?? '') ?: DBA::NULL_DATETIME),
|
||||||
|
'finish' => DateTimeFormat::utc(($arr['finish'] ?? '') ?: DBA::NULL_DATETIME),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
$event['created'] = DateTimeFormat::utc(($arr['created'] ?? '') ?: 'now');
|
|
||||||
$event['edited'] = DateTimeFormat::utc(($arr['edited'] ?? '') ?: 'now');
|
|
||||||
$event['start'] = DateTimeFormat::utc(($arr['start'] ?? '') ?: DBA::NULL_DATETIME);
|
|
||||||
$event['finish'] = DateTimeFormat::utc(($arr['finish'] ?? '') ?: DBA::NULL_DATETIME);
|
|
||||||
if ($event['finish'] < DBA::NULL_DATETIME) {
|
if ($event['finish'] < DBA::NULL_DATETIME) {
|
||||||
$event['finish'] = DBA::NULL_DATETIME;
|
$event['finish'] = DBA::NULL_DATETIME;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue