1 <?php
2
3 /*
4 * This file is part of the ICanBoogie package.
5 *
6 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace ICanBoogie\Mailer;
13
14 /**
15 * Message mailer.
16 */
17 class Mailer
18 {
19 protected $deliverer;
20
21 public function __construct($deliverer=null)
22 {
23 if (!$deliverer)
24 {
25 $deliverer = new MailDeliverer;
26 }
27
28 $this->deliverer = $deliverer;
29 }
30
31 public function __invoke(Message $message)
32 {
33 return $this->deliver($message);
34 }
35
36 public function deliver(Message $message)
37 {
38 return $this->deliverer->deliver($message, $this);
39 }
40 }