Code Duplication    Length = 11-14 lines in 2 locations

apps/dav/lib/CardDAV/CardDavBackend.php 2 locations

@@ 323-336 (lines=14) @@
320
			'synctoken' => 1
321
		];
322
323
		foreach ($properties as $property=>$newValue) {
324
			switch ($property) {
325
				case '{DAV:}displayname':
326
					$values['displayname'] = $newValue;
327
					break;
328
				case '{' . Plugin::NS_CARDDAV . '}addressbook-description':
329
					$values['description'] = $newValue;
330
					break;
331
				default:
332
					throw new BadRequest('Unknown property: ' . $property);
333
			}
334
		}
335
336
		// Fallback to make sure the displayname is set. Some clients may refuse
337
		// to work with addressbooks not having a displayname.
338
		if ($values['displayname'] === null) {
339
			$values['displayname'] = $url;
@@ 279-289 (lines=11) @@
276
277
		$propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
278
			$updates = [];
279
			foreach ($mutations as $property=>$newValue) {
280
				switch ($property) {
281
					case '{DAV:}displayname':
282
						$updates['displayname'] = $newValue;
283
						break;
284
					case '{' . Plugin::NS_CARDDAV . '}addressbook-description':
285
						$updates['description'] = $newValue;
286
						break;
287
				}
288
			}
289
			$query = $this->db->getQueryBuilder();
290
			$query->update('addressbooks');
291
292
			foreach ($updates as $key=>$value) {