/** * @param string * @param string * @param string * @param array|string * @return bool|MailWrappedMessage * @throws MailWrapperSetupException */ public static function getMailMessage() { $args = func_get_args(); $fromEmail = array_shift($args); $subject = array_shift($args); $content = array_shift($args); $toEmails = MailAddressManager::combineRecipients($args); if (!count($toEmails)) { return false; } $message = new MailWrappedMessage(); $message->setFrom($fromEmail); $message->setSubject($subject); $message->setContentText($content); foreach ($toEmails as $address) { $message->addToRecipient($address); } return $message; }
/** * */ public function testTwoMultiLevelArraysTwoArray() { $email1 = [self::$toAddresses, self::$from]; $email2 = [self::$bccAddresses, self::$ccAddresses]; $response = MailAddressManager::combineRecipients($email1, $email2); $this->assertCount(7, $response); }
/** * */ public function testClassString() { $emailString = self::$toAddresses[0]; $email = new TesterEmailEntityString(); $email->myEmail = $emailString; $result = MailAddressManager::combineRecipients($email); $this->assertCount(1, $result); $this->assertEquals($emailString, $result[0]); }