Code Duplication    Length = 1-4 lines in 8 locations

api/src/Mail.php 8 locations

@@ 4725-4728 (lines=4) @@
4722
	{
4723
		if (self::$debug) error_log( __METHOD__.__LINE__."(".array2string($_uid).", $_partID, $_folder, $_preserveSeen, $_stream, $_encoding, $_tryDecodingServerside)");
4724
4725
		if (empty($_folder))
4726
		{
4727
			$_folder = (isset($this->sessionData['mailbox'])&&$this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
4728
		}
4729
		//error_log(__METHOD__.' ('.__LINE__.') '.array2string($_folder).'/'.$this->icServer->getCurrentMailbox().'/'. $this->sessionData['mailbox']);
4730
		// querying contents of body part
4731
		$uidsToFetch = new Horde_Imap_Client_Ids();
@@ 5167-5167 (lines=1) @@
5164
	function getMessageEnvelope($_uid, $_partID = '',$decode=false, $_folder='', $_useHeaderInsteadOfEnvelope=false)
5165
	{
5166
		//error_log(__METHOD__.' ('.__LINE__.') '.":$_uid,$_partID,$decode,$_folder".function_backtrace());
5167
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5168
		//error_log(__METHOD__.' ('.__LINE__.') '.":$_uid,$_partID,$decode,$_folder");
5169
		if((empty($_partID)||$_partID=='null')&&$_useHeaderInsteadOfEnvelope===false) {
5170
			$uidsToFetch = new Horde_Imap_Client_Ids();
@@ 5300-5300 (lines=1) @@
5297
	function getMessageHeader($_uid, $_partID = '',$decode=false, $preserveUnSeen=false, $_folder='')
5298
	{
5299
		//error_log(__METHOD__.' ('.__LINE__.') '.':'.$_uid.', '.$_partID.', '.$decode.', '.$preserveUnSeen.', '.$_folder);
5300
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5301
		$uidsToFetch = new Horde_Imap_Client_Ids();
5302
		if (!(is_object($_uid) || is_array($_uid))) $_uid = (array)$_uid;
5303
		$uidsToFetch->add($_uid);
@@ 5378-5378 (lines=1) @@
5375
	function getMessageRawHeader($_uid, $_partID = '', $_folder = '')
5376
	{
5377
		static $rawHeaders;
5378
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5379
		//error_log(__METHOD__.' ('.__LINE__.') '." Try Using Cache for raw Header $_uid, $_partID in Folder $_folder");
5380
5381
		if (is_null($rawHeaders)||!is_array($rawHeaders)) $rawHeaders = Cache::getCache(Cache::INSTANCE,'email','rawHeadersCache'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),60*60*1);
@@ 5504-5504 (lines=1) @@
5501
		//TODO: caching einbauen static!
5502
		static $rawBody;
5503
		if (is_null($rawBody)) $rawBody = array();
5504
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5505
		if (!$_stream && isset($rawBody[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)]))
5506
		{
5507
			//error_log(__METHOD__.' ('.__LINE__.') '." Using Cache for raw Body $_uid, $_partID in Folder $_folder");
@@ 5565-5568 (lines=4) @@
5562
	{
5563
		if (self::$debug) error_log( __METHOD__.' ('.__LINE__.') '.":$_uid, $_partID");
5564
5565
		if (empty($_folder))
5566
		{
5567
			$_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5568
		}
5569
		$uidsToFetch = new Horde_Imap_Client_Ids();
5570
		if (!(is_object($_uid) || is_array($_uid))) $_uid = (array)$_uid;
5571
		$uidsToFetch->add($_uid);
@@ 5611-5611 (lines=1) @@
5608
	function getMessageAttachments($_uid, $_partID=null, Horde_Mime_Part $_structure=null, $fetchEmbeddedImages=true, $fetchTextCalendar=false, $resolveTNEF=true, $_folder='')
5609
	{
5610
		if (self::$debug) error_log( __METHOD__.":$_uid, $_partID");
5611
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5612
		$attachments = array();
5613
		if (!isset($_structure))
5614
		{
@@ 5865-5865 (lines=1) @@
5862
	function getAttachment($_uid, $_partID, $_winmail_nr=0, $_returnPart=true, $_stream=false, $_folder=null)
5863
	{
5864
		//error_log(__METHOD__.__LINE__."Uid:$_uid, PartId:$_partID, WinMailNr:$_winmail_nr, ReturnPart:$_returnPart, Stream:$_stream, Folder:$_folder".function_backtrace());
5865
		if (!isset($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5866
5867
		$uidsToFetch = new Horde_Imap_Client_Ids();
5868
		if (!(is_object($_uid) || is_array($_uid))) $_uid = (array)$_uid;