-
-
Notifications
You must be signed in to change notification settings - Fork 829
/
Mail.php
40 lines (33 loc) · 1.07 KB
/
Mail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Extend;
use Flarum\Extension\Extension;
use Flarum\Mail\DriverInterface;
use Illuminate\Contracts\Container\Container;
class Mail implements ExtenderInterface
{
private array $drivers = [];
/**
* Add a mail driver.
*
* @param string $identifier: Identifier for mail driver. E.g. 'smtp' for SmtpDriver.
* @param class-string<DriverInterface> $driver: ::class attribute of driver class, which must implement \Flarum\Mail\DriverInterface.
* @return self
*/
public function driver(string $identifier, string $driver): self
{
$this->drivers[$identifier] = $driver;
return $this;
}
public function extend(Container $container, Extension $extension = null): void
{
$container->extend('mail.supported_drivers', function ($existingDrivers) {
return array_merge($existingDrivers, $this->drivers);
});
}
}