Code Duplication    Length = 6-6 lines in 3 locations

lib/connector/importconnector.php 1 location

@@ 111-116 (lines=6) @@
108
	public function updateImageProperty(&$property, $entry, $version=null) {
109
		$image = new \OC_Image();
110
		$image->loadFromData($entry);
111
		if (strcmp($version, '4.0') == 0) {
112
			$type = $image->mimeType();
113
		} else {
114
			$arrayType = explode('/', $image->mimeType());
115
			$type = strtoupper(array_pop($arrayType));
116
		}
117
		$property->add('ENCODING', 'b');
118
		$property->add('TYPE', $type);
119
		$property->setValue($image->__toString());

lib/connector/ldapconnector.php 1 location

@@ 174-179 (lines=6) @@
171
		for ($i=0; $i<count($v_property); $i++) {
172
			$image = new \OC_Image();
173
			$image->loadFromData($ldap_entry);
174
			if (strcmp($version, '4.0') == 0) {
175
				$type = $image->mimeType();
176
			} else {
177
				$arrayType = explode('/', $image->mimeType());
178
				$type = strtoupper(array_pop($arrayType));
179
			}
180
			$v_property[$i]->add('ENCODING', 'b');
181
			$v_property[$i]->add('TYPE', $type);
182
			$v_property[$i]->setValue($image->__toString());

lib/contact.php 1 location

@@ 459-464 (lines=6) @@
456
		// For vCard 3.0 the type must be e.g. JPEG or PNG
457
		// For version 4.0 the full mimetype should be used.
458
		// https://tools.ietf.org/html/rfc2426#section-3.1.4
459
		if (strval($this->VERSION) === '4.0') {
460
			$type = $photo->mimeType();
461
		} else {
462
			$type = explode('/', $photo->mimeType());
463
			$type = strtoupper(array_pop($type));
464
		}
465
		if (isset($this->PHOTO)) {
466
			$this->remove('PHOTO');
467
		}