Code Duplication    Length = 7-7 lines in 3 locations

lib/contact.php 3 locations

@@ 72-78 (lines=7) @@
69
70
		if (!is_null($data)) {
71
			if ($data instanceof VObject\VCard) {
72
				foreach ($data->children as $child) {
73
					if($child->name === 'VERSION' || $child->name === 'PRODID') {
74
						parent::__set($child->name, $child);
75
					} else {
76
						$this->add($child);
77
					}
78
				}
79
				$this->setRetrieved(true);
80
			} elseif (is_array($data)) {
81
				foreach ($data as $key => $value) {
@@ 354-360 (lines=7) @@
351
				if ($result) {
352
					if (isset($result['vcard'])
353
						&& $result['vcard'] instanceof VObject\VCard) {
354
						foreach ($result['vcard']->children() as $child) {
355
							if($child->name === 'VERSION' || $child->name === 'PRODID') {
356
								parent::__set($child->name, $child);
357
							} else {
358
								$this->add($child);
359
							}
360
						}
361
						$this->setRetrieved(true);
362
						return true;
363
					} elseif (isset($result['carddata'])) {
@@ 391-397 (lines=7) @@
388
					\Sabre\VObject\Reader::OPTION_IGNORE_INVALID_LINES
389
				);
390
				if ($obj) {
391
					foreach ($obj->children as $child) {
392
						if($child->name === 'VERSION' || $child->name === 'PRODID') {
393
							parent::__set($child->name, $child);
394
						} else {
395
							$this->add($child);
396
						}
397
					}
398
					$this->setRetrieved(true);
399
					$this->setSaved(true);
400
				} else {