Skip to content

Commit

Permalink
Make mailable properties public (#16916)
Browse files Browse the repository at this point in the history
  • Loading branch information
sileence authored and taylorotwell committed Dec 22, 2016
1 parent 2931e2a commit 4a5f484
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 57 deletions.
70 changes: 16 additions & 54 deletions src/Illuminate/Mail/Mailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,84 +19,84 @@ class Mailable implements MailableContract
*
* @var array
*/
protected $from = [];
public $from = [];

/**
* The "to" recipients of the message.
*
* @var array
*/
protected $to = [];
public $to = [];

/**
* The "cc" recipients of the message.
*
* @var array
*/
protected $cc = [];
public $cc = [];

/**
* The "bcc" recipients of the message.
*
* @var array
*/
protected $bcc = [];
public $bcc = [];

/**
* The "reply to" recipients of the message.
*
* @var array
*/
protected $replyTo = [];
public $replyTo = [];

/**
* The subject of the message.
*
* @var string
*/
protected $subject;
public $subject;

/**
* The view to use for the message.
*
* @var string
*/
protected $view;
public $view;

/**
* The plain text view to use for the message.
*
* @var string
*/
protected $textView;
public $textView;

/**
* The view data for the message.
*
* @var array
*/
protected $viewData = [];
public $viewData = [];

/**
* The attachments for the message.
*
* @var array
*/
protected $attachments = [];
public $attachments = [];

/**
* The raw attachments for the message.
*
* @var array
*/
protected $rawAttachments = [];
public $rawAttachments = [];

/**
* The callbacks for the message.
*
* @var array
*/
protected $callbacks = [];
public $callbacks = [];

/**
* Send the message using the given mailer.
Expand Down Expand Up @@ -185,12 +185,14 @@ protected function buildView()
*
* @return array
*/
protected function buildViewData()
public function buildViewData()
{
$data = $this->viewData;

foreach ((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
$data[$property->getName()] = $property->getValue($this);
if ($property->getDeclaringClass()->getName() != self::class) {
$data[$property->getName()] = $property->getValue($this);
}
}

return $data;
Expand Down Expand Up @@ -505,46 +507,6 @@ public function withSwiftMessage($callback)
return $this;
}

/**
* Get the sender of the message.
*
* @return array
*/
public function getFrom()
{
return $this->from;
}

/**
* Get the "to" recipients of the message.
*
* @return array
*/
public function getTo()
{
return $this->to;
}

/**
* Get the "bcc" recipients of the message.
*
* @return array
*/
public function getBcc()
{
return $this->bcc;
}

/**
* Get the "cc" recipients of the message.
*
* @return array
*/
public function getCc()
{
return $this->cc;
}

/**
* Dynamically bind parameters to the message.
*
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Support/Testing/Fakes/MailFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ public function send($view, array $data = [], $callback = null)

$mailable->mailable = $view;

if ($recipients = $view->getTo()) {
if ($recipients = $view->to) {
$mailable->to($recipients);
}

if ($recipients = $view->getBcc()) {
if ($recipients = $view->bcc) {
$mailable->bcc($recipients);
}

if ($recipients = $view->getCc()) {
if ($recipients = $view->cc) {
$mailable->cc($recipients);
}

Expand Down

0 comments on commit 4a5f484

Please sign in to comment.