Code Duplication    Length = 25-25 lines in 2 locations

apps/dav/lib/CalDAV/CalDavBackend.php 2 locations

@@ 182-206 (lines=25) @@
179
		$stmt = $query->execute();
180
181
		$calendars = [];
182
		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
183
184
			$components = [];
185
			if ($row['components']) {
186
				$components = explode(',',$row['components']);
187
			}
188
189
			$calendar = [
190
				'id' => $row['id'],
191
				'uri' => $row['uri'],
192
				'principaluri' => $this->convertPrincipal($row['principaluri'], false),
193
				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
194
				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
195
				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
196
				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
197
			];
198
199
			foreach($this->propertyMap as $xmlName=>$dbName) {
200
				$calendar[$xmlName] = $row[$dbName];
201
			}
202
203
			if (!isset($calendars[$calendar['id']])) {
204
				$calendars[$calendar['id']] = $calendar;
205
			}
206
		}
207
208
		$stmt->closeCursor();
209
@@ 283-307 (lines=25) @@
280
		$stmt = $query->execute();
281
282
		$calendars = [];
283
		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
284
285
			$components = [];
286
			if ($row['components']) {
287
				$components = explode(',',$row['components']);
288
			}
289
290
			$calendar = [
291
				'id' => $row['id'],
292
				'uri' => $row['uri'],
293
				'principaluri' => $this->convertPrincipal($row['principaluri'], false),
294
				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
295
				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
296
				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
297
				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
298
			];
299
300
			foreach($this->propertyMap as $xmlName=>$dbName) {
301
				$calendar[$xmlName] = $row[$dbName];
302
			}
303
304
			if (!isset($calendars[$calendar['id']])) {
305
				$calendars[$calendar['id']] = $calendar;
306
			}
307
		}
308
309
		$stmt->closeCursor();
310