Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c942e25

Browse files
committed
Extract method.
1 parent 235c733 commit c942e25

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

src/Illuminate/Mail/MailServiceProvider.php

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,7 @@ public function register()
3838
$app['view'], $app['swift.mailer'], $app['events']
3939
);
4040

41-
if ($app->bound('log'))
42-
{
43-
$mailer->setLogger($app['log']);
44-
}
45-
46-
if ($app->bound('queue'))
47-
{
48-
$mailer->setQueue($app['queue']);
49-
}
50-
51-
$mailer->setContainer($app);
41+
$this->setMailerDependencies($mailer, $app);
5242

5343
// If a "from" address is set, we will set it on the mailer so that all mail
5444
// messages sent by the applications will utilize the same "from" address
@@ -71,6 +61,28 @@ public function register()
7161
});
7262
}
7363

64+
/**
65+
* Set a few dependencies on the mailer instance.
66+
*
67+
* @param \Illuminate\Mail\Mailer $mailer
68+
* @param \Illuminate\Foundation\Application $app
69+
* @return void
70+
*/
71+
protected function setMailerDependencies($mailer, $app)
72+
{
73+
$mailer->setContainer($app);
74+
75+
if ($app->bound('log'))
76+
{
77+
$mailer->setLogger($app['log']);
78+
}
79+
80+
if ($app->bound('queue'))
81+
{
82+
$mailer->setQueue($app['queue']);
83+
}
84+
}
85+
7486
/**
7587
* Register the Swift Mailer instance.
7688
*

0 commit comments

Comments
 (0)