Completed
Push — master ( 4cc80e...c361a4 )
by De Cramer
13s
created

NotificationsPlugin   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 46
rs 10
c 0
b 0
f 0
ccs 0
cts 10
cp 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A setStatus() 0 7 2
1
<?php
2
3
namespace eXpansion\Framework\Notifications\Plugins;
4
5
use eXpansion\Framework\Core\Model\UserGroups\Group;
6
use eXpansion\Framework\Core\Plugins\StatusAwarePluginInterface;
7
use eXpansion\Framework\Notifications\Plugins\Gui\NotificationUpdater;
8
use eXpansion\Framework\Notifications\Plugins\Gui\NotificationWidget;
9
10
/**
11
 * Class CustomUi
12
 *
13
 * @package eXpansion\Framework\CustomUi\Plugins
14
 */
15
class NotificationsPlugin implements StatusAwarePluginInterface
16
{
17
18
    /**@var Group */
19
    protected $allPlayers;
20
21
    /**
22
     * @var NotificationWidget
23
     */
24
    private $notificationWidget;
25
    /**
26
     * @var NotificationUpdater
27
     */
28
    private $notificationUpdater;
29
30
    /**
31
     * CustomUi constructor.
32
     *
33
     * @param NotificationWidget  $notificationWidget
34
     * @param NotificationUpdater $notificationUpdater
35
     * @param Group               $allPlayers
36
     */
37
    public function __construct(
38
        NotificationWidget $notificationWidget,
39
        NotificationUpdater $notificationUpdater,
40
        Group $allPlayers
41
    ) {
42
43
        $this->notificationWidget = $notificationWidget;
44
        $this->notificationUpdater = $notificationUpdater;
45
        $this->allPlayers = $allPlayers;
46
    }
47
48
49
    /**
50
     * @inheritdoc
51
     */
52
    public function setStatus($status)
53
    {
54
        if ($status) {
55
            $this->notificationWidget->create($this->allPlayers);
56
            $this->notificationUpdater->create($this->allPlayers);
57
        }
58
    }
59
60
}
61