summaryrefslogtreecommitdiff
path: root/app/ServiceProvider/NotificationProvider.php
blob: 2cb015762901eb15ffd2da0105dfb657b26a84e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

namespace Kanboard\ServiceProvider;

use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Kanboard\Model\UserNotificationType;
use Kanboard\Model\ProjectNotificationType;
use Kanboard\Notification\MailNotification as MailNotification;
use Kanboard\Notification\WebNotification as WebNotification;

/**
 * Notification Provider
 *
 * @package Kanboard\ServiceProvider
 * @author  Frederic Guillot
 */
class NotificationProvider implements ServiceProviderInterface
{
    /**
     * Register providers
     *
     * @access public
     * @param  \Pimple\Container $container
     * @return \Pimple\Container
     */
    public function register(Container $container)
    {
        $container['userNotificationType'] = function ($container) {
            $type = new UserNotificationType($container);
            $type->setType(MailNotification::TYPE, t('Email'), '\Kanboard\Notification\MailNotification');
            $type->setType(WebNotification::TYPE, t('Web'), '\Kanboard\Notification\WebNotification');
            return $type;
        };

        $container['projectNotificationType'] = function ($container) {
            $type = new ProjectNotificationType($container);
            $type->setType('webhook', 'Webhook', '\Kanboard\Notification\WebhookNotification', true);
            $type->setType('activity_stream', 'ActivityStream', '\Kanboard\Notification\ActivityStreamNotification', true);
            return $type;
        };

        return $container;
    }
}