Code Duplication    Length = 14-15 lines in 2 locations

api/src/Mail.php 2 locations

@@ 5406-5419 (lines=14) @@
5403
			'ids' => $uidsToFetch,
5404
		));
5405
		if (is_object($headersNew)) {
5406
			foreach($headersNew as &$_headerObject) {
5407
				$retValue = $_headerObject->getHeaderText();
5408
				if ($_partID != '')
5409
				{
5410
					$mailStructureObject = $_headerObject->getStructure();
5411
					foreach ($mailStructureObject->contentTypeMap() as $mime_id => $mime_type)
5412
					{
5413
						if ($mime_id==$_partID)
5414
						{
5415
							$retValue = $_headerObject->getHeaderText($mime_id);
5416
						}
5417
					}
5418
				}
5419
			}
5420
		}
5421
		$rawHeaders[$this->icServer->ImapServerId][(string)$_folder][$_uid][(empty($_partID)?'NIL':$_partID)]=$retValue;
5422
		Cache::setCache(Cache::INSTANCE,'email','rawHeadersCache'.trim($GLOBALS['egw_info']['user']['account_id']),$rawHeaders,60*60*1);
@@ 5527-5541 (lines=15) @@
5524
			'ids' => $uidsToFetch,
5525
		));
5526
		if (is_object($headersNew)) {
5527
			foreach($headersNew as &$_headerObject) {
5528
				$body = $_headerObject->getFullMsg($_stream);
5529
				if ($_partID != '')
5530
				{
5531
					$mailStructureObject = $_headerObject->getStructure();
5532
					//_debug_array($mailStructureObject->contentTypeMap());
5533
					foreach ($mailStructureObject->contentTypeMap() as $mime_id => $mime_type)
5534
					{
5535
						if ($mime_id==$_partID)
5536
						{
5537
							$body = $_headerObject->getBodyPart($mime_id, $_stream);
5538
						}
5539
					}
5540
				}
5541
			}
5542
		}
5543
		//error_log(__METHOD__.' ('.__LINE__.') '."[$this->icServer->ImapServerId][$_folder][$_uid][".(empty($_partID)?'NIL':$_partID)."]");
5544
		if (!$_stream)