Code Duplication    Length = 16-16 lines in 2 locations

lib/connector/importcsvconnector.php 1 location

@@ 153-168 (lines=16) @@
150
						$values = explode($importEntry['separator'], $value);
151
					}
152
					
153
					foreach ($values as $oneValue) {
154
						if (isset($importEntry->vcard_favourites)) {
155
							foreach ($importEntry->vcard_favourites as $vcardFavourite) {
156
								if (strcasecmp((string)$vcardFavourite, trim($oneValue)) == 0) {
157
									$property = $vcard->createProperty("X-FAVOURITES", 'yes');
158
									$vcard->add($property);
159
								} else {
160
									$property = $this->getOrCreateVCardProperty($vcard, $importEntry->vcard_entry);
161
									$this->updateProperty($property, $importEntry, trim($oneValue));
162
								}
163
							}
164
						} else {
165
							$property = $this->getOrCreateVCardProperty($vcard, $importEntry->vcard_entry);
166
							$this->updateProperty($property, $importEntry, trim($oneValue));
167
						}
168
					}
169
				} else if (isset($element[$i]) && isset($title[$i])) {
170
					$property = $vcard->createProperty("X-Unknown-Element", StringUtil::convertToUTF8($element[$i]));
171
					$property->add('TYPE', StringUtil::convertToUTF8($title[$i]));

lib/connector/importvcardconnector.php 1 location

@@ 128-143 (lines=16) @@
125
					$values = explode($importEntry['separator'], $value);
126
				}
127
				
128
				foreach ($values as $oneValue) {
129
					if (isset($importEntry->vcard_favourites)) {
130
						foreach ($importEntry->vcard_favourites as $vcardFavourite) {
131
							if (strcasecmp((string)$vcardFavourite, trim($oneValue)) == 0) {
132
								$property = $dest->createProperty("X-FAVOURITES", 'yes');
133
								$dest->add($property);
134
							} else {
135
								$property = $this->getOrCreateVCardProperty($dest, $importEntry->vcard_entry);
136
								$this->updateProperty($property, $importEntry, trim($oneValue));
137
							}
138
						}
139
					} else {
140
						$property = $this->getOrCreateVCardProperty($dest, $importEntry->vcard_entry);
141
						$this->updateProperty($property, $importEntry, $sourceProperty->getValue());
142
					}
143
				}
144
			} else {
145
				$property = clone $sourceProperty;
146
				// VERSION and PRODID are set by default in any new empty vcard object.