Code Duplication    Length = 11-14 lines in 2 locations

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

@@ 248-258 (lines=11) @@
245
		$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
246
247
			$updates = [];
248
			foreach($mutations as $property=>$newValue) {
249
250
				switch($property) {
251
					case '{DAV:}displayname' :
252
						$updates['displayname'] = $newValue;
253
						break;
254
					case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
255
						$updates['description'] = $newValue;
256
						break;
257
				}
258
			}
259
			$query = $this->db->getQueryBuilder();
260
			$query->update('addressbooks');
261
@@ 293-306 (lines=14) @@
290
			'synctoken' => 1
291
		];
292
293
		foreach($properties as $property=>$newValue) {
294
295
			switch($property) {
296
				case '{DAV:}displayname' :
297
					$values['displayname'] = $newValue;
298
					break;
299
				case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
300
					$values['description'] = $newValue;
301
					break;
302
				default :
303
					throw new BadRequest('Unknown property: ' . $property);
304
			}
305
306
		}
307
308
		// Fallback to make sure the displayname is set. Some clients may refuse
309
		// to work with addressbooks not having a displayname.