@@ -26,41 +26,41 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class MailServiceFactory implements FactoryInterface |
| 28 | 28 | { |
| 29 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
| 30 | - { |
|
| 31 | - $config = $container->get('Config'); |
|
| 32 | - $mails = isset($config['mails']) ? $config['mails'] : []; |
|
| 29 | + public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) |
|
| 30 | + { |
|
| 31 | + $config = $container->get('Config'); |
|
| 32 | + $mails = isset($config['mails']) ? $config['mails'] : []; |
|
| 33 | 33 | |
| 34 | - /* @var \Auth\Options\ModuleOptions $authOptions */ |
|
| 35 | - $authOptions = $container->get('Auth/Options'); |
|
| 34 | + /* @var \Auth\Options\ModuleOptions $authOptions */ |
|
| 35 | + $authOptions = $container->get('Auth/Options'); |
|
| 36 | 36 | |
| 37 | - /* @var \Core\Options\MailServiceOptions $mailServiceOptions */ |
|
| 38 | - $mailServiceOptions = $container->get('Core/MailServiceOptions'); |
|
| 37 | + /* @var \Core\Options\MailServiceOptions $mailServiceOptions */ |
|
| 38 | + $mailServiceOptions = $container->get('Core/MailServiceOptions'); |
|
| 39 | 39 | |
| 40 | - $configArray = [ |
|
| 41 | - 'from' => [ |
|
| 42 | - 'name' => $authOptions->getFromName(), |
|
| 43 | - 'email' => $authOptions->getFromEmail() |
|
| 44 | - ], |
|
| 45 | - ]; |
|
| 40 | + $configArray = [ |
|
| 41 | + 'from' => [ |
|
| 42 | + 'name' => $authOptions->getFromName(), |
|
| 43 | + 'email' => $authOptions->getFromEmail() |
|
| 44 | + ], |
|
| 45 | + ]; |
|
| 46 | 46 | |
| 47 | - $configArray['transport'] = $this->getTransport($mailServiceOptions); |
|
| 48 | - $configArray = array_merge($configArray, $mails); |
|
| 47 | + $configArray['transport'] = $this->getTransport($mailServiceOptions); |
|
| 48 | + $configArray = array_merge($configArray, $mails); |
|
| 49 | 49 | |
| 50 | - $config = new MailServiceConfig($configArray); |
|
| 51 | - $service = new MailService($container,$config->toArray()); |
|
| 52 | - $config->configureServiceManager($service); |
|
| 53 | - foreach($config->toArray() as $name=>$value){ |
|
| 54 | - $method = 'set'.$name; |
|
| 55 | - if(method_exists($service,$method)){ |
|
| 56 | - call_user_func([$service,$method],$value); |
|
| 57 | - } |
|
| 58 | - } |
|
| 50 | + $config = new MailServiceConfig($configArray); |
|
| 51 | + $service = new MailService($container,$config->toArray()); |
|
| 52 | + $config->configureServiceManager($service); |
|
| 53 | + foreach($config->toArray() as $name=>$value){ |
|
| 54 | + $method = 'set'.$name; |
|
| 55 | + if(method_exists($service,$method)){ |
|
| 56 | + call_user_func([$service,$method],$value); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - return $service; |
|
| 61 | - } |
|
| 60 | + return $service; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - public function getTransport(MailServiceOptions $mailServiceOptions) |
|
| 63 | + public function getTransport(MailServiceOptions $mailServiceOptions) |
|
| 64 | 64 | { |
| 65 | 65 | $type = $mailServiceOptions->getTransportClass(); |
| 66 | 66 | if (MailService::TRANSPORT_SMTP == $type) { |