summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/ServiceProvider/ClassProvider.php9
-rw-r--r--app/ServiceProvider/MailProvider.php34
-rw-r--r--app/common.php1
3 files changed, 35 insertions, 9 deletions
diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php
index 154b921f..aa0f1111 100644
--- a/app/ServiceProvider/ClassProvider.php
+++ b/app/ServiceProvider/ClassProvider.php
@@ -4,7 +4,6 @@ namespace Kanboard\ServiceProvider;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
-use Kanboard\Core\Mail\Client as EmailClient;
use Kanboard\Core\ObjectStorage\FileStorage;
use Kanboard\Core\Paginator;
use Kanboard\Core\Http\OAuth2;
@@ -161,14 +160,6 @@ class ClassProvider implements ServiceProviderInterface
return new FileStorage(FILES_DIR);
};
- $container['emailClient'] = function ($container) {
- $mailer = new EmailClient($container);
- $mailer->setTransport('smtp', '\Kanboard\Core\Mail\Transport\Smtp');
- $mailer->setTransport('sendmail', '\Kanboard\Core\Mail\Transport\Sendmail');
- $mailer->setTransport('mail', '\Kanboard\Core\Mail\Transport\Mail');
- return $mailer;
- };
-
$container['cspRules'] = array(
'default-src' => "'self'",
'style-src' => "'self' 'unsafe-inline'",
diff --git a/app/ServiceProvider/MailProvider.php b/app/ServiceProvider/MailProvider.php
new file mode 100644
index 00000000..685709e3
--- /dev/null
+++ b/app/ServiceProvider/MailProvider.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Kanboard\Core\Mail\Client as EmailClient;
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+
+/**
+ * Mail Provider
+ *
+ * @package Kanboard\ServiceProvider
+ * @author Frederic Guillot
+ */
+class MailProvider implements ServiceProviderInterface
+{
+ /**
+ * Registers services on the given container.
+ *
+ * @param Container $container
+ */
+ public function register(Container $container)
+ {
+ $container['emailClient'] = function ($container) {
+ $mailer = new EmailClient($container);
+ $mailer->setTransport('smtp', '\Kanboard\Core\Mail\Transport\Smtp');
+ $mailer->setTransport('sendmail', '\Kanboard\Core\Mail\Transport\Sendmail');
+ $mailer->setTransport('mail', '\Kanboard\Core\Mail\Transport\Mail');
+ return $mailer;
+ };
+
+ return $container;
+ }
+}
diff --git a/app/common.php b/app/common.php
index e018aa12..4781ddb4 100644
--- a/app/common.php
+++ b/app/common.php
@@ -31,6 +31,7 @@ require __DIR__.'/constants.php';
require __DIR__.'/check_setup.php';
$container = new Pimple\Container;
+$container->register(new Kanboard\ServiceProvider\MailProvider());
$container->register(new Kanboard\ServiceProvider\HelperProvider());
$container->register(new Kanboard\ServiceProvider\SessionProvider());
$container->register(new Kanboard\ServiceProvider\LoggingProvider());