Skip to content

Commit

Permalink
Initial work cleaning up Mail component.
Browse files Browse the repository at this point in the history
Removes SuperClosure dependency. Cleans up classes… must use mailable
with Mail::queue or Mail::later.
  • Loading branch information
taylorotwell committed Dec 20, 2016
1 parent 98b3a24 commit 50ab994
Show file tree
Hide file tree
Showing 11 changed files with 198 additions and 420 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"classpreloader/classpreloader": "~3.0",
"doctrine/inflector": "~1.0",
"erusev/parsedown": "~1.6",
"jeremeamia/superclosure": "~2.2",
"league/flysystem": "~1.0",
"monolog/monolog": "~1.11",
"mtdowling/cron-expression": "~1.0",
Expand Down
95 changes: 0 additions & 95 deletions src/Illuminate/Mail/Jobs/HandleQueuedMessage.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/Illuminate/Mail/MailServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ protected function registerIlluminateMailer()
*/
protected function setMailerDependencies($mailer, $app)
{
$mailer->setContainer($app);

if ($app->bound('queue')) {
$mailer->setQueue($app['queue']);
}
Expand Down
26 changes: 19 additions & 7 deletions src/Illuminate/Mail/Mailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,7 @@ protected function setAddress($address, $name = null, $property = 'to')
}

if ($address instanceof Collection || is_array($address)) {
foreach ($address as $user) {
$user = $this->parseUser($user);

$this->{$property}($user->email, isset($user->name) ? $user->name : null);
}
$this->setArrayOfAddresses($address, $property);
} else {
$this->{$property}[] = compact('address', 'name');
}
Expand All @@ -402,12 +398,28 @@ protected function setAddress($address, $name = null, $property = 'to')
}

/**
* Parse the given user into an object.
* Set an array of message recipients.
*
* @param \Illuminate\Support\Collection|array $users
* @param string $property
* @return void
*/
protected function setArrayOfAddresses($users, $property = 'to')
{
foreach ($users as $user) {
$user = $this->convertUserToObject($user);

$this->{$property}($user->email, isset($user->name) ? $user->name : null);
}
}

/**
* Convert the given user into an object.
*
* @param mixed $user
* @return object
*/
protected function parseUser($user)
protected function convertUserToObject($user)
{
if (is_array($user)) {
return (object) $user;
Expand Down
Loading

1 comment on commit 50ab994

@tai1030
Copy link

@tai1030 tai1030 commented on 50ab994 Sep 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start from this commit, not support Guzzle 5, right?

Please sign in to comment.