Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Make properties in the mailable class public #16916

Merged
merged 1 commit into from
Dec 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -212,15 +212,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