Skip to content

Commit 81c555b

Browse files
committed
Removes redundant getFrom method and test
1 parent e3af135 commit 81c555b

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

src/PostmarkTransport.php

+2-18
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,6 @@ protected function getContacts($contacts)
116116
->implode(',');
117117
}
118118

119-
/**
120-
* Get the "From" payload field for the API request.
121-
*
122-
* @param \Swift_Mime_SimpleMessage $message
123-
*
124-
* @return string
125-
*/
126-
protected function getFrom(Swift_Mime_SimpleMessage $message)
127-
{
128-
return collect($message->getFrom())
129-
->map(function ($display, $address) {
130-
return $display ? "$display <$address>" : $address;
131-
})
132-
->values()
133-
->implode(',');
134-
}
135-
136119
/**
137120
* Get the message ID from the response.
138121
*
@@ -160,6 +143,7 @@ protected function payload(Swift_Mime_SimpleMessage $message)
160143
$headers = $message->getHeaders();
161144

162145
$to = $this->getContacts($message->getTo());
146+
$from = $this->getContacts($message->getFrom());
163147
$cc = $this->getContacts($message->getCc());
164148
$bcc = $this->getContacts($message->getBcc());
165149
$replyTo = $this->getContacts($message->getReplyTo());
@@ -171,7 +155,7 @@ protected function payload(Swift_Mime_SimpleMessage $message)
171155
'X-Postmark-Server-Token' => $this->key,
172156
],
173157
'json' => [
174-
'From' => $this->getFrom($message),
158+
'From' => $from,
175159
'To' => $to,
176160
'Cc' => $cc,
177161
'Bcc' => $bcc,

tests/PostmarkTransportTest.php

-9
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ public function can_given_contacts_into_a_comma_separated_string()
5858
$this->assertEquals('[email protected]', $replyTo);
5959
}
6060

61-
/** @test */
62-
public function can_get_the_from_field_as_a_string()
63-
{
64-
$string = $this->invokeMethod($this->transport, 'getFrom', [$this->message]);
65-
66-
$this->assertEquals('[email protected]', $string);
67-
$this->assertNotEquals('[email protected]', $string);
68-
}
69-
7061
/** @test */
7162
public function can_create_the_proper_payload_for_a_message()
7263
{

0 commit comments

Comments
 (0)