$em->remove($subscriber); $em->flush(); $app['session']->getFlashBag()->add('message', sprintf('You successfully unsubscribed!')); } return $app->redirect('/'); }); $app['swift'] = function ($app) { $conf = $app['config']; $transport = new Swift_SmtpTransport(); $transport->setHost($conf->get('smtp.host')); $transport->setPort($conf->get('smtp.port')); $transport->setUsername($conf->get('smtp.username')); $transport->setPassword($conf->get('smtp.password')); $transport->setEncryption($conf->get('smtp.security')); $mailer = new Swift_Mailer($transport); $mailer->registerPLugin(new CssInlinerPlugin()); return $mailer; }; $app['rfc.builder'] = function ($app) { return new RfcBuilder($app['config']->get('storagePath')); }; $app['rfc.service'] = function ($app) { return new RfcService($app['rfc.builder'], $app['config']->get('rfcUrl')); }; $app['diff.service'] = function ($app) { return new DiffService(); }; $app['slack.api'] = function ($app) { $interactor = new CurlInteractor(); $interactor->setResponseFactory(new SlackResponseFactory()); return new Commander(null, $interactor);