Code Duplication    Length = 11-14 lines in 2 locations

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

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