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

NotificationsPlugin::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 5
cp 0
cc 1
eloc 7
nc 1
nop 3
crap 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