Skip to content

Commit

Permalink
extract method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Feb 28, 2017
1 parent 6ee838f commit 717f1f6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Illuminate/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,7 @@ public function plain($view, array $data, $callback)
public function send($view, array $data = [], $callback = null)
{
if ($view instanceof MailableContract) {
if ($view instanceof ShouldQueue) {
return $view->queue($this->queue);
}

return $view->send($this);
return $this->sendMailable($view);
}

// First we need to parse the view, which could either be a string or an array
Expand All @@ -213,6 +209,18 @@ public function send($view, array $data = [], $callback = null)
$this->sendSwiftMessage($message->getSwiftMessage());
}

/**
* Send the given mailable.
*
* @param MailableContract $mailable
* @return void
*/
protected function sendMailable($mailable)
{
return $mailable instanceof ShouldQueue
? $mailable->queue($this->queue) : $mailable->send($this);
}

/**
* Parse the given view name or array.
*
Expand Down

0 comments on commit 717f1f6

Please sign in to comment.