Code Duplication    Length = 11-14 lines in 2 locations

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

@@ 321-331 (lines=11) @@
318
		$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
319
320
			$updates = [];
321
			foreach($mutations as $property=>$newValue) {
322
323
				switch($property) {
324
					case '{DAV:}displayname' :
325
						$updates['displayname'] = $newValue;
326
						break;
327
					case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
328
						$updates['description'] = $newValue;
329
						break;
330
				}
331
			}
332
			$query = $this->db->getQueryBuilder();
333
			$query->update('addressbooks');
334
@@ 366-379 (lines=14) @@
363
			'synctoken' => 1
364
		];
365
366
		foreach($properties as $property=>$newValue) {
367
368
			switch($property) {
369
				case '{DAV:}displayname' :
370
					$values['displayname'] = $newValue;
371
					break;
372
				case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
373
					$values['description'] = $newValue;
374
					break;
375
				default :
376
					throw new BadRequest('Unknown property: ' . $property);
377
			}
378
379
		}
380
381
		// Fallback to make sure the displayname is set. Some clients may refuse
382
		// to work with addressbooks not having a displayname.