Code Duplication    Length = 1-4 lines in 8 locations

api/src/Mail.php 8 locations

@@ 4628-4631 (lines=4) @@
4625
	{
4626
		if (self::$debug) error_log( __METHOD__.__LINE__."(".array2string($_uid).", $_partID, $_folder, $_preserveSeen, $_stream, $_encoding, $_tryDecodingServerside)");
4627
4628
		if (empty($_folder))
4629
		{
4630
			$_folder = (isset($this->sessionData['mailbox'])&&$this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
4631
		}
4632
		//error_log(__METHOD__.' ('.__LINE__.') '.array2string($_folder).'/'.$this->icServer->getCurrentMailbox().'/'. $this->sessionData['mailbox']);
4633
		// querying contents of body part
4634
		$uidsToFetch = new Horde_Imap_Client_Ids();
@@ 5069-5069 (lines=1) @@
5066
	function getMessageEnvelope($_uid, $_partID = '',$decode=false, $_folder='', $_useHeaderInsteadOfEnvelope=false)
5067
	{
5068
		//error_log(__METHOD__.' ('.__LINE__.') '.":$_uid,$_partID,$decode,$_folder".function_backtrace());
5069
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5070
		//error_log(__METHOD__.' ('.__LINE__.') '.":$_uid,$_partID,$decode,$_folder");
5071
		if((empty($_partID)||$_partID=='null')&&$_useHeaderInsteadOfEnvelope===false) {
5072
			$uidsToFetch = new Horde_Imap_Client_Ids();
@@ 5202-5202 (lines=1) @@
5199
	function getMessageHeader($_uid, $_partID = '',$decode=false, $preserveUnSeen=false, $_folder='')
5200
	{
5201
		//error_log(__METHOD__.' ('.__LINE__.') '.':'.$_uid.', '.$_partID.', '.$decode.', '.$preserveUnSeen.', '.$_folder);
5202
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5203
		$uidsToFetch = new Horde_Imap_Client_Ids();
5204
		if (!(is_object($_uid) || is_array($_uid))) $_uid = (array)$_uid;
5205
		$uidsToFetch->add($_uid);
@@ 5280-5280 (lines=1) @@
5277
	function getMessageRawHeader($_uid, $_partID = '', $_folder = '')
5278
	{
5279
		static $rawHeaders;
5280
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5281
		//error_log(__METHOD__.' ('.__LINE__.') '." Try Using Cache for raw Header $_uid, $_partID in Folder $_folder");
5282
5283
		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);
@@ 5405-5405 (lines=1) @@
5402
		//TODO: caching einbauen static!
5403
		static $rawBody;
5404
		if (is_null($rawBody)) $rawBody = array();
5405
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5406
		if (isset($rawBody[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)]))
5407
		{
5408
			//error_log(__METHOD__.' ('.__LINE__.') '." Using Cache for raw Body $_uid, $_partID in Folder $_folder");
@@ 5463-5466 (lines=4) @@
5460
	{
5461
		if (self::$debug) error_log( __METHOD__.' ('.__LINE__.') '.":$_uid, $_partID");
5462
5463
		if (empty($_folder))
5464
		{
5465
			$_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5466
		}
5467
		$uidsToFetch = new Horde_Imap_Client_Ids();
5468
		if (!(is_object($_uid) || is_array($_uid))) $_uid = (array)$_uid;
5469
		$uidsToFetch->add($_uid);
@@ 5509-5509 (lines=1) @@
5506
	function getMessageAttachments($_uid, $_partID=null, Horde_Mime_Part $_structure=null, $fetchEmbeddedImages=true, $fetchTextCalendar=false, $resolveTNEF=true, $_folder='')
5507
	{
5508
		if (self::$debug) error_log( __METHOD__.":$_uid, $_partID");
5509
		if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5510
		$attachments = array();
5511
		if (!isset($_structure))
5512
		{
@@ 5763-5763 (lines=1) @@
5760
	function getAttachment($_uid, $_partID, $_winmail_nr=0, $_returnPart=true, $_stream=false, $_folder=null)
5761
	{
5762
		//error_log(__METHOD__.__LINE__."Uid:$_uid, PartId:$_partID, WinMailNr:$_winmail_nr, ReturnPart:$_returnPart, Stream:$_stream, Folder:$_folder".function_backtrace());
5763
		if (!isset($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
5764
5765
		$uidsToFetch = new Horde_Imap_Client_Ids();
5766
		if (!(is_object($_uid) || is_array($_uid))) $_uid = (array)$_uid;