Skip to content

Commit 5a446ee

Browse files
committed
Fix PHP warning
1 parent bb90bcd commit 5a446ee

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

main/inc/lib/agenda.lib.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,18 +1110,20 @@ public function getEvents(
11101110
break;
11111111
}
11121112

1113-
if (!empty($this->events)) {
1114-
switch ($format) {
1115-
case 'json':
1116-
return json_encode($this->events);
1117-
break;
1118-
case 'array':
1119-
return $this->events;
1120-
break;
1121-
}
1113+
switch ($format) {
1114+
case 'json':
1115+
if (empty($this->events)) {
1116+
return '';
1117+
}
1118+
return json_encode($this->events);
1119+
break;
1120+
case 'array':
1121+
if (empty($this->events)) {
1122+
return [];
1123+
}
1124+
return $this->events;
1125+
break;
11221126
}
1123-
1124-
return '';
11251127
}
11261128

11271129
/**

0 commit comments

Comments
 (0)