@@ -70,27 +70,35 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function start(Container $container): void |
| 72 | 72 | { |
| 73 | - if ($container->has(JobRegistry::class)) { |
|
| 73 | + if ($container->has(JobRegistry::class)) |
|
| 74 | + { |
|
| 74 | 75 | // Will be removed since v3.0 |
| 75 | 76 | $registry = $container->get(JobRegistry::class); |
| 76 | 77 | $registry->setHandler(MailQueue::JOB_NAME, MailJob::class); |
| 77 | 78 | $registry->setSerializer(MailQueue::JOB_NAME, JsonJobSerializer::class); |
| 78 | 79 | $container->bindSingleton( |
| 79 | 80 | MailerInterface::class, |
| 80 | - static function (MailerConfig $config) use ($container) { |
|
| 81 | - if ($config->getQueueConnection() === 'sync') { |
|
| 81 | + static function (MailerConfig $config) use ($container) |
|
| 82 | + { |
|
| 83 | + if ($config->getQueueConnection() === 'sync') |
|
| 84 | + { |
|
| 82 | 85 | $queue = $container->get(ShortCircuit::class); |
| 83 | - } else { |
|
| 86 | + } |
|
| 87 | + else |
|
| 88 | + { |
|
| 84 | 89 | $queue = $container->get(QueueInterface::class); |
| 85 | 90 | } |
| 86 | 91 | |
| 87 | 92 | return new MailQueue($config, $queue); |
| 88 | 93 | } |
| 89 | 94 | ); |
| 90 | - } else { |
|
| 95 | + } |
|
| 96 | + else |
|
| 97 | + { |
|
| 91 | 98 | $container->bindSingleton( |
| 92 | 99 | MailerInterface::class, |
| 93 | - static function (MailerConfig $config, QueueConnectionProviderInterface $provider) { |
|
| 100 | + static function (MailerConfig $config, QueueConnectionProviderInterface $provider) |
|
| 101 | + { |
|
| 94 | 102 | return new MailQueue( |
| 95 | 103 | $config, |
| 96 | 104 | $provider->getConnection($config->getQueueConnection()) |
@@ -99,7 +107,8 @@ discard block |
||
| 99 | 107 | ); |
| 100 | 108 | } |
| 101 | 109 | |
| 102 | - if ($container->has(HandlerRegistryInterface::class)) { |
|
| 110 | + if ($container->has(HandlerRegistryInterface::class)) |
|
| 111 | + { |
|
| 103 | 112 | $registry = $container->get(HandlerRegistryInterface::class); |
| 104 | 113 | $registry->setHandler(MailQueue::JOB_NAME, MailJob::class); |
| 105 | 114 | } |