protected function createTransport(array $config)
    {
        if (!isset($config['class'])) {
            $config['class'] = 'Swift_SendmailTransport';
        }
        if (isset($config['plugins'])) {
            $plugins = $config['plugins'];
            unset($config['plugins']);
        } else {
            $plugins = [];
        }

        if ($this->enableSwiftMailerLogging) {
            $plugins[] = [
                'class' => 'Swift_Plugins_LoggerPlugin',
                'constructArgs' => [
                    [
                        'class' => 'yii\swiftmailer\Logger'
                    ]
                ],
            ];
        }

        /* @var $transport \Swift_Transport */
        $transport = $this->createSwiftObject($config);
        if (!empty($plugins)) {
            foreach ($plugins as $plugin) {
                if (is_array($plugin) && isset($plugin['class'])) {
                    $plugin = $this->createSwiftObject($plugin);
                }
                $transport->registerPlugin($plugin);
            }
        }

        return $transport;
    }
protected function createTransport(array $config)
    {
        if (!isset($config['class'])) {
            $config['class'] = 'Swift_SendmailTransport';
        }
        if (isset($config['plugins'])) {
            $plugins = $config['plugins'];
            unset($config['plugins']);
        } else {
            $plugins = [];
        }

        if ($this->enableSwiftMailerLogging) {
            $plugins[] = [
                'class' => 'Swift_Plugins_LoggerPlugin',
                'constructArgs' => [
                    [
                        'class' => 'yii\swiftmailer\Logger'
                    ]
                ],
            ];
        }

        /* @var $transport \Swift_Transport */
        $transport = $this->createSwiftObject($config);
        if (!empty($plugins)) {
            foreach ($plugins as $plugin) {
                if (is_array($plugin) && isset($plugin['class'])) {
                    $plugin = $this->createSwiftObject($plugin);
                }
                $transport->registerPlugin($plugin);
            }
        }

        return $transport;
    }
protected function createTransport ( array $ config ) { if ( ! isset ( $ config [ 'class' ] ) ) { $ config [ 'class' ] = 'Swift_SendmailTransport' ; } if ( isset ( $ config [ 'plugins' ] ) ) { $ plugins = $ config [ 'plugins' ] ; unset ( $ config [ 'plugins' ] ) ; } else { $ plugins = [ ] ; } if ( $ this -> enableSwiftMailerLogging ) { $ plugins [ ] = [ 'class' => 'Swift_Plugins_LoggerPlugin' , 'constructArgs' => [ [ 'class' => 'yii\swiftmailer\Logger' ] ] , ] ; } /* @var $transport \Swift_Transport */ $ transport = $ this -> createSwiftObject ( $ config ) ; if ( ! empty ( $ plugins ) ) { foreach ( $ plugins as $ plugin ) { if ( is_array ( $ plugin ) && isset ( $ plugin [ 'class' ] ) ) { $ plugin = $ this -> createSwiftObject ( $ plugin ) ; } $ transport -> registerPlugin ( $ plugin ) ; } } return $ transport ; }
Creates email transport instance by its array configuration.
@param array $config transport configuration.
@throws \yii\base\InvalidConfigException on invalid transport configuration.
@return \Swift_Transport transport instance.
Creates email transport instance by its array configuration .