Example #1
0
 /**
  * Create exception handler.
  * Instance of config should be this same as for application.
  */
 public function __construct(Config $config, $view)
 {
     $this->view = $view;
     $this->data['debug'] = $config->get('debug');
     $this->data['project'] = $config->get('app.project', 'Vero');
     $this->data['admin'] = $config->get('app.admin');
     $this->data['basepath'] = $config->get('routing.base', '/');
     $this->sensitive = [$config->get('salt'), $config->get('database.password')];
 }
Example #2
0
 /**
  * Create Swift Mailer instance from config.
  * 
  * @param Config $config
  * @return \Swift_Mailer
  */
 public static function create(Config $config)
 {
     switch ($config->get('mail.transport', 'mail')) {
         case 'smtp':
             $transport = \Swift_SmtpTransport::newInstance($config->get('mail.host', 'localhost'), $config->get('mail.port', 25));
             $transport->setUsername($config->get('mail.username'));
             $transport->setPassword($config->get('mail.password'));
             break;
         case 'sendmail':
             $transport = \Swift_SendmailTransport::newInstance();
             if ($path = $config->get('mail.path')) {
                 $transport->setCommand($path);
             }
             break;
         case 'mail':
             $transport = \Swift_MailTransport::newInstance();
     }
     return \Swift_Mailer::newInstance($transport);
 }