Code Duplication    Length = 11-14 lines in 2 locations

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

@@ 351-361 (lines=11) @@
348
		$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
349
350
			$updates = [];
351
			foreach($mutations as $property=>$newValue) {
352
353
				switch($property) {
354
					case '{DAV:}displayname' :
355
						$updates['displayname'] = $newValue;
356
						break;
357
					case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
358
						$updates['description'] = $newValue;
359
						break;
360
				}
361
			}
362
			$query = $this->db->getQueryBuilder();
363
			$query->update('addressbooks');
364
@@ 396-409 (lines=14) @@
393
			'synctoken' => 1
394
		];
395
396
		foreach($properties as $property=>$newValue) {
397
398
			switch($property) {
399
				case '{DAV:}displayname' :
400
					$values['displayname'] = $newValue;
401
					break;
402
				case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
403
					$values['description'] = $newValue;
404
					break;
405
				default :
406
					throw new BadRequest('Unknown property: ' . $property);
407
			}
408
409
		}
410
411
		// Fallback to make sure the displayname is set. Some clients may refuse
412
		// to work with addressbooks not having a displayname.