| Total Complexity | 3 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 23 | class DispatcherFactory |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * @var \Mandrill $service |
||
| 27 | */ |
||
| 28 | protected $service; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * DispatcherFactory constructor. |
||
| 32 | * |
||
| 33 | * If no api key is provided, Mandrill will check for an environment variable MANDRILL_APIKEY |
||
| 34 | * If those don't exits, Mandrill will look for ~/.mandrill.key or /etc/mandrill.key |
||
| 35 | * |
||
| 36 | * @param string $apiKey |
||
| 37 | * @throws \Mandrill_Error |
||
| 38 | */ |
||
| 39 | public function __construct(string $apiKey = null) |
||
| 40 | { |
||
| 41 | $this->service = new \Mandrill($apiKey); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return Message\Dispatcher |
||
| 46 | */ |
||
| 47 | public function createMessageDispatcher() |
||
| 48 | { |
||
| 49 | return new Message\Dispatcher($this->service->messages); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return Message\AsyncDispatcher |
||
| 54 | */ |
||
| 55 | public function createAsyncMessageDispatcher() |
||
| 58 | } |
||
| 59 | } |
||
| 60 |