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 use ICanBoogie\Core;
15
16 class Hooks
17 {
18 /**
19 * Returns a {@link Mailer} instance.
20 *
21 * @param Core $core
22 *
23 * @return \ICanBoogie\Mailer\Mailer
24 */
25 static public function core_lazy_get_mailer(Core $core)
26 {
27 // TODO-20140312: Create instance with a "mailer" configuration.
28
29 return new Mailer;
30 }
31
32 /**
33 * Send the message using the mailer available at `$core->mailer`.
34 *
35 * @param Core $core
36 *
37 * @param array|Message $message A message source suitable for {@link Message::from()}.
38 *
39 * @return mixed
40 */
41 static public function core_mail(Core $core, $message)
42 {
43 $mailer = $core->mailer;
44 $message = Message::from($message);
45
46 return $mailer($message);
47 }
48 }