Code Duplication    Length = 5-5 lines in 4 locations

api/src/Mail.php 4 locations

@@ 506-510 (lines=5) @@
503
		{
504
			self::resetConnectionErrorCache($_profileID);
505
			$rawHeadersCache = Cache::getCache(Cache::INSTANCE,'email','rawHeadersCache'.trim($account_id),$callback=null,$callback_params=array(),$expiration=60*60*1);
506
			if (isset($rawHeadersCache[$_profileID]))
507
			{
508
				unset($rawHeadersCache[$_profileID]);
509
				Cache::setCache(Cache::INSTANCE,'email','rawHeadersCache'.trim($account_id),$rawHeadersCache, $expiration=60*60*1);
510
			}
511
			$HierarchyDelimiterCache = Cache::getCache(Cache::INSTANCE,'email','HierarchyDelimiter'.trim($account_id),$callback=null,$callback_params=array(),$expiration=60*60*24*5);
512
			if (isset($HierarchyDelimiterCache[$_profileID]))
513
			{
@@ 512-516 (lines=5) @@
509
				Cache::setCache(Cache::INSTANCE,'email','rawHeadersCache'.trim($account_id),$rawHeadersCache, $expiration=60*60*1);
510
			}
511
			$HierarchyDelimiterCache = Cache::getCache(Cache::INSTANCE,'email','HierarchyDelimiter'.trim($account_id),$callback=null,$callback_params=array(),$expiration=60*60*24*5);
512
			if (isset($HierarchyDelimiterCache[$_profileID]))
513
			{
514
				unset($HierarchyDelimiterCache[$_profileID]);
515
				Cache::setCache(Cache::INSTANCE,'email','HierarchyDelimiter'.trim($account_id),$HierarchyDelimiterCache, $expiration=60*60*24*5);
516
			}
517
			//reset folderObject cache, to trigger reload
518
			self::resetFolderObjectCache($_profileID);
519
			//reset counter of deleted messages per folder
@@ 521-525 (lines=5) @@
518
			self::resetFolderObjectCache($_profileID);
519
			//reset counter of deleted messages per folder
520
			$eMailListContainsDeletedMessages = Cache::getCache(Cache::INSTANCE,'email','eMailListContainsDeletedMessages'.trim($account_id),$callback=null,$callback_params=array(),$expiration=60*60*1);
521
			if (isset($eMailListContainsDeletedMessages[$_profileID]))
522
			{
523
				unset($eMailListContainsDeletedMessages[$_profileID]);
524
				Cache::setCache(Cache::INSTANCE,'email','eMailListContainsDeletedMessages'.trim($account_id),$eMailListContainsDeletedMessages, $expiration=60*60*1);
525
			}
526
			$vacationCached = Cache::getCache(Cache::INSTANCE, 'email', 'vacationNotice'.trim($account_id),$callback=null,$callback_params=array(),$expiration=60*60*24*1);
527
			if (isset($vacationCached[$_profileID]))
528
			{
@@ 527-531 (lines=5) @@
524
				Cache::setCache(Cache::INSTANCE,'email','eMailListContainsDeletedMessages'.trim($account_id),$eMailListContainsDeletedMessages, $expiration=60*60*1);
525
			}
526
			$vacationCached = Cache::getCache(Cache::INSTANCE, 'email', 'vacationNotice'.trim($account_id),$callback=null,$callback_params=array(),$expiration=60*60*24*1);
527
			if (isset($vacationCached[$_profileID]))
528
			{
529
				unset($vacationCached[$_profileID]);
530
				Cache::setCache(Cache::INSTANCE,'email','vacationNotice'.trim($account_id),$vacationCached, $expiration=60*60*24*1);
531
			}
532
533
			if (isset(self::$instances[$_profileID])) unset(self::$instances[$_profileID]);
534
		}