-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add array transport in order to store Swift messages in memory.
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Illuminate\Mail\Transport; | ||
|
||
use Swift_Mime_Message; | ||
use Illuminate\Support\Collection; | ||
|
||
class ArrayTransport extends Transport | ||
{ | ||
/** | ||
* The collection of Swift Messages | ||
* | ||
* @var \Illuminate\Support\Collection | ||
*/ | ||
protected $messages; | ||
|
||
/** | ||
* Create a new array transport instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->messages = new Collection; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function send(Swift_Mime_Message $message, &$failedRecipients = null) | ||
{ | ||
$this->beforeSendPerformed($message); | ||
|
||
$this->messages[] = $message; | ||
|
||
return $this->numberOfRecipients($message); | ||
} | ||
|
||
/** | ||
* Return the collection of messages. | ||
* | ||
* @return \Illuminate\Support\Collection | ||
*/ | ||
public function getMessages() | ||
{ | ||
return $this->messages; | ||
} | ||
|
||
public function clearMessages() | ||
{ | ||
return $this->messages = new Collection; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters