Code Duplication    Length = 6-6 lines in 4 locations

lib/addressbook.php 4 locations

@@ 261-266 (lines=6) @@
258
			);
259
		}
260
261
		if (!$this->getBackend()->hasContactMethodFor(\OCP\PERMISSION_CREATE)) {
262
			throw new \Exception(
263
				self::$l10n->t('The backend for this address book does not support adding contacts'),
264
				Http::STATUS_NOT_IMPLEMENTED
265
			);
266
		}
267
268
		$contact = new Contact($this, $this->backend, $data);
269
@@ 313-318 (lines=6) @@
310
			);
311
		}
312
313
		if (!$this->getBackend()->hasContactMethodFor(\OCP\PERMISSION_DELETE)) {
314
			throw new \Exception(
315
				self::$l10n->t('The backend for this address book does not support deleting contacts'),
316
				Http::STATUS_NOT_IMPLEMENTED
317
			);
318
		}
319
320
		if ($this->backend->deleteContact($this->getId(), $id, $options)) {
321
			if (isset($this->objects[$id])) {
@@ 353-358 (lines=6) @@
350
			);
351
		}
352
353
		if (!$this->getBackend()->hasContactMethodFor(\OCP\PERMISSION_DELETE)) {
354
			throw new \Exception(
355
				self::$l10n->t('The backend for this address book does not support deleting contacts'),
356
				Http::STATUS_NOT_IMPLEMENTED
357
			);
358
		}
359
360
		$response = array();
361
@@ 424-429 (lines=6) @@
421
			);
422
		}
423
424
		if (!$this->getBackend()->hasContactMethodFor(\OCP\PERMISSION_UPDATE)) {
425
			throw new \Exception(
426
				self::$l10n->t('The backend for this address book does not support updating'),
427
				Http::STATUS_NOT_IMPLEMENTED
428
			);
429
		}
430
431
		if (count($data) === 0) {
432
			return false;