Code Duplication    Length = 11-14 lines in 2 locations

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

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