Code Duplication    Length = 11-14 lines in 2 locations

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

@@ 276-286 (lines=11) @@
273
		$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
274
275
			$updates = [];
276
			foreach($mutations as $property=>$newValue) {
277
278
				switch($property) {
279
					case '{DAV:}displayname' :
280
						$updates['displayname'] = $newValue;
281
						break;
282
					case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
283
						$updates['description'] = $newValue;
284
						break;
285
				}
286
			}
287
			$query = $this->db->getQueryBuilder();
288
			$query->update('addressbooks');
289
@@ 321-334 (lines=14) @@
318
			'synctoken' => 1
319
		];
320
321
		foreach($properties as $property=>$newValue) {
322
323
			switch($property) {
324
				case '{DAV:}displayname' :
325
					$values['displayname'] = $newValue;
326
					break;
327
				case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
328
					$values['description'] = $newValue;
329
					break;
330
				default :
331
					throw new BadRequest('Unknown property: ' . $property);
332
			}
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.