jbostoen/itop-jb-mail-to-ticket-automation-v2

Duplicate function in message helper

Closed this issue · 3 comments

GetMessageId is being duplicated in the class.
Also, missing namespace mapping in autoloader.

Hi @poojaajudia , can you be more specific please?

PHP error: for duplicate function GetMessageId in MessageHelper class.

The second function should be GetMessageSentTime instead. We have a reference of this function in other class while it doesn't exist in MessageHelper.

Also, a zip folder in latest release can't find MessageHelper class, again php error. The reason is vendor folder doesn't include MessageHelper namespace. I can fix this by running composer dump-autoload after extracting code from zip, but still it's good to correct dependency.

namespace Combodo\iTop\Extension\Helper;

class MessageHelper {
	
	/**
	 * Returns Message-ID of an e-mail.
	 *
	 * @param \Object $oMessage Laminas e-mail object
	 *
	 * @return \String
	 */
	public static function GetMessageId($oMessage) {
		
		return $oMessage->getHeader('Message-ID', 'string');
		
	}
	
	/**
	 * Returns Message-ID of an e-mail.
	 *
	 * @param \Object $oMessage Laminas e-mail object
	 *
	 * @return \Integer UNIX timestamp
	 */
	public static function GetMessageId($oMessage) {
        ...

Thanks @jbostoen for a quick fix.