1 | <?php |
||
2 | |||
3 | namespace Da\Mailer\Builder; |
||
4 | |||
5 | use Da\Mailer\Mailer; |
||
6 | use Da\Mailer\Transport\TransportFactory; |
||
7 | use Exception; |
||
8 | |||
9 | class MailerBuilder extends Buildable |
||
10 | { |
||
11 | /** |
||
12 | * @param string|null $broker |
||
13 | * @return Mailer |
||
14 | * @throws Exception |
||
15 | */ |
||
16 | public static function make($broker = null) |
||
17 | { |
||
18 | $config = self::getConfig(); |
||
19 | |||
20 | $transportType = $broker ?? $config['config']['transport']; |
||
21 | $connectionValues = $config['transports'][$transportType]; |
||
22 | $transport = TransportFactory::create($connectionValues, $transportType)->create(); |
||
23 | |||
24 | return new Mailer($transport); |
||
0 ignored issues
–
show
|
|||
25 | } |
||
26 | } |
||
27 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: