Register the SMTP Swift Transport instance.

@param  array  $config
@return void
489882
protected function registerSmtpTransport($config)
	{
		$this->app['swift.transport'] = $this->app->share(function($app) use ($config)
		{
			extract($config);

			// The Swift SMTP transport instance will allow us to use any SMTP backend
			// for delivering mail such as Sendgrid, Amazon SMS, or a custom server
			// a developer has available. We will just pass this configured host.
			$transport = SmtpTransport::newInstance($host, $port);

			if (isset($encryption))
			{
				$transport->setEncryption($encryption);
			}

			// Once we have the transport we will check for the presence of a username
			// and password. If we have it we will set the credentials on the Swift
			// transporter instance so that we'll properly authenticate delivery.
			if (isset($username))
			{
				$transport->setUsername($username);

				$transport->setPassword($password);
			}

			return $transport;
		});
	}
1228151
public function initialize(array $config = [])
    {
        $this->setConfig($config);
        $this->_registry->getController()->viewBuilder()->setHelpers(['Recaptcha.Recaptcha' => $this->_config]);
    }
106371
public function addFromConfig(array $config)
    {
        foreach ($config as $name => $data) {
            $params     = isset($data['params']) ? $data['params'] : array();
            $parameters = array();
            foreach ($params as $nameParam => $param) {
                if (empty($params['type'])) {
                    $params['type'] = 'string';
                }

                switch ($param['type']) {

                    case 'int':
                        $param['type'] = Parameter::TYPE_INTEGER;
                        break;

                    case 'mixed':
                        $param['type'] = Parameter::TYPE_MIXED;
                        break;

                    case 'string':
                        $param['type'] = Parameter::TYPE_STRING;
                        break;

                    default:
                        // Consider  current value as regexp
                }
                $parameters[$nameParam] = new Parameter($nameParam, $param['type'], (bool) $param['mandatory']);
            }
            $this->add(new Route($name, $data['route'], $data['controller'], $parameters));
        }

        return $this;
    }
50115
public function loadConfig(array $config)
    {
        $this->devServerEnabled = $config['dev_server_enable'];
        $this->devServerHost = $config['dev_server_host'];
        $this->devServerPort = $config['dev_server_port'];
    }
286958
public function createSmtpDriver($config = [])
    {
        $config = array_merge(Config::get(), $config);

        $transport = Swift_SmtpTransport::newInstance(
            $config['host'], $config['port'], $config['security']
        );

        if (isset($config['addr'])) {
            $transport->setUsername($config['addr']);
            $transport->setPassword($config['pass']);
        }

        if (isset($config['stream'])) {
            $transport->setStreamOptions($config['stream']);
        }

        return $transport;
    }
435615
private function getCurrentMailer(array $config)
    {
        if ($this->mailer !== null) {
            return $this->mailer;
        }

        if ($config['mailer'] == 'smtp') {
            $transport = \Swift_SmtpTransport::newInstance(
                $config['smtpHost'],
                $config['smtpPort'],
                $config['smtpSecurity']
            );
            $transport->setUsername($config['smtpUsername']);
            $transport->setPassword($config['smtpPassword']);
        } elseif ($config['mailer'] == 'mail') {
            $transport = \Swift_MailTransport::newInstance();
        } else {
            $transport = \Swift_SendmailTransport::newInstance();
        }

        return \Swift_Mailer::newInstance($transport);
    }
413263
private function loadConfig($parsedConfig) {
        if(isset($parsedConfig['moduleConf']['Type']) && $parsedConfig['moduleConf']['Type'] == "smtp"){
            
            $this->transport = \Swift_SmtpTransport::newInstance();

            if(isset($parsedConfig['moduleConf']['Host']) && $parsedConfig['moduleConf']['Host'] != ""){
                $this->transport->setHost($parsedConfig['moduleConf']['Host']);
            }

            if(isset($parsedConfig['moduleConf']['Port']) && $parsedConfig['moduleConf']['Port'] != ""){
                $this->transport->setPort($parsedConfig['moduleConf']['Port']);
            }

            if(isset($parsedConfig['moduleConf']['Username']) && $parsedConfig['moduleConf']['Username'] != ""){
                $this->transport->setUsername($parsedConfig['moduleConf']['Username']);
            }

            if(isset($parsedConfig['moduleConf']['Password']) && $parsedConfig['moduleConf']['Password'] != ""){
                $this->transport->setPassword($parsedConfig['moduleConf']['Password']);
            }

            if(isset($parsedConfig['moduleConf']['Encryption']) && $parsedConfig['moduleConf']['Encryption'] != ""){
                $this->transport->setEncryption($parsedConfig['moduleConf']['Encryption']);
            }

        }
        elseif(isset($parsedConfig['moduleConf']['Type']) && $parsedConfig['moduleConf']['Type'] == "sendmail"){

            $this->transport = \Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');

        }else{

            $this->transport = \Swift_MailTransport::newInstance();

        }

    }
999145
public function setupTracy($config = [])
    {
        $tracy = Tracy::instance($config);
        $databasePanel = $tracy->getPanel('database');
        $this->dispatcher->listen(QueryExecuted::class, function ($event) use ($databasePanel) {
            $sql = $event->sql;
            $bindings = $event->bindings;
            $time = $event->time;
            $name = $event->connectionName;
            $pdo = $event->connection->getPdo();

            $databasePanel->logQuery($sql, $bindings, $time, $name, $pdo);
        });
    }
698442
private function setup(array $config) {
		$r = new C(null, $config + [
			'timeout' => 120
			/**
			 * 2017-07-16
			 * By default it is «Zend_Http_Client»: @see C::$config
			 * https://github.com/magento/zf1/blob/1.13.1/library/Zend/Http/Client.php#L126
			 */
			,'useragent' => 'Mage2.PRO'
		]); /** @var C $r */
		/** @var aProxy|aSocket $a */
		if (!($p = $this->proxy())) {  /** @var IProxy $p */
			$a = new aSocket;
		}
		else {
			// 2019-01-14
			// https://framework.zend.com/manual/1.12/en/zend.http.client.adapters.html#zend.http.client.adapters.proxy
			$a = new aProxy;
			$r->setConfig([
				'proxy_host' => $p->host()
				,'proxy_pass' => $p->password()
				,'proxy_port' => $p->port()
				,'proxy_user' => $p->username()
			]);
		}
		if ($p || !$this->verifyCertificate()) {
			$ssl = ['allow_self_signed' => true, 'verify_peer' => false]; /** @var array(string => bool) $ssl */
			if ($p) {
				// 2019-01-14 It is needed for my proxy: https://stackoverflow.com/a/32047219
				$ssl['verify_peer_name'] = false;
			}
			$a->setStreamContext(['ssl' => $ssl]);
		}
		$r->setAdapter($a);
		return $r;
	}
357955
protected function writeConfigFile(array $config)
    {
        $dumper = new \Symfony\Component\Yaml\Dumper();
        $yaml = $dumper->dump($config, 4);

        file_put_contents($this->configFilePath, $yaml);
    }
715199
public function initialize(array $config)
    {
        $controller = $this->_registry->getController();
        $this->request = $controller->request;
        $this->response = $controller->response;
        $this->session = $controller->request->session();

        $this->eventManager($controller->eventManager());
        $this->eventManager()->dispatch(new Event('Guardian.getGuestActions', $this));

        if (!self::$_instance) {
            self::$_instance = &$this;
        }
    }
1308382
public function registerSwiftMailer()
    {
        $this->registerSwiftTransport();

        // Once we have the transporter registered, we will register the actual Swift
        // mailer instance, passing in the transport instances, which allows us to
        // override this transporter instances during app start-up if necessary.
        $this->app->singleton('swift.mailer', function () {
            if ($domain = $this->app->make('config')->get('mail.domain')) {
                Swift_DependencyContainer::getInstance()
                                ->register('mime.idgenerator.idright')
                                ->asValue($domain);
            }

            return new Swift_Mailer($this->app['swift.transport']->driver());
        });
    }
545158
public function registerSwiftMailer()
    {
        $this->registerSwiftTransport();

        // Once we have the transporter registered, we will register the actual Swift
        // mailer instance, passing in the transport instances, which allows us to
        // override this transporter instances during app start-up if necessary.
        $this->app->singleton('swift.mailer', function ($app) {
            return new Swift_Mailer($app['swift.transport']->driver());
        });
    }
92249
public function initialize(array $config)
    {
        parent::initialize($config);

        $this->table('tickets');
        $this->displayField('name');
        $this->primaryKey('id');

        $this->addBehavior('Timestamp');
    }
50265
public function initialize(array $config)
    {
        parent::initialize($config);

        $this->setTable('tags');
        $this->setDisplayField('tag');
        $this->setPrimaryKey('id');

        $this->belongsToMany('Posts', ['className' => 'MeCms.Posts', 'joinTable' => 'posts_tags'])
            ->setForeignKey('tag_id')
            ->setTargetForeignKey('post_id')
            ->setThrough('MeCms.PostsTags');

        $this->addBehavior('Timestamp');

        $this->_validatorClass = TagValidator::class;
    }
1245673
protected function registerSwiftMailer()
	{
		$config = $this->app['config']['mail'];

		$this->registerSwiftTransport($config);

		// Once we have the transporter registered, we will register the actual Swift
		// mailer instance, passing in the transport instances, which allows us to
		// override this transporter instances during app start-up if necessary.
		$this->app['swift.mailer'] = $this->app->share(function($app)
		{
			return new Swift_Mailer($app['swift.transport']);
		});
	}
706636
public function init( $config = [ ] )
    {
        $this->initDefaults();

        $this->initMail( $config );

        $this->initLog( $config );

        $this->initDatabase( $config );

        $this->initRequest( $config );

        $this->initRouter( $config );

        $this->initSession( $config );

        $this->initAppName( $config );

        $this->initDefaultLanguage( $config );

//        $this->_initMaintenanceMode( $config );
    }