Completed
Pull Request — master (#304)
by
unknown
04:02
created

TotoPlugin::onPlayerInfoChanged()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 2
1
<?php
2
3
namespace eXpansion\Bundle\Acme\Plugins;
4
5
use eXpansion\Bundle\Acme\Plugins\Gui\TotoWindowFactory;
6
use eXpansion\Framework\Core\DataProviders\Listener\ListenerInterfaceExpApplication;
7
use eXpansion\Framework\Core\Helpers\Time;
8
use eXpansion\Framework\Core\Model\UserGroups\Group;
9
use eXpansion\Framework\Core\Plugins\StatusAwarePluginInterface;
10
use eXpansion\Framework\Core\Services\Console;
11
use eXpansion\Framework\Notifications\Services\Notifications;
12
13
/**
14
 * TotoPlugin is a test plugin to be removed.
15
 *
16
 * @package eXpansion\Framework\Core\Plugins
17
 */
18
class TotoPlugin implements ListenerInterfaceExpApplication, StatusAwarePluginInterface
19
{
20
    /** @var Console */
21
    protected $console;
22
23
    /** @var TotoWindowFactory */
24
    protected $mlFactory;
25
26
    /** @var Group */
27
    protected $playersGroup;
28
    /**
29
     * @var Notifications
30
     */
31
    private $notifications;
32
    /**
33
     * @var Time
34
     */
35
    private $time;
36
37
    /**
38
     * TotoPlugin constructor.
39
     * @param Group             $players
40
     * @param Console           $console
41
     * @param Notifications     $notifications
42
     * @param TotoWindowFactory $mlFactory
43
     * @param Time              $time
44
     */
45
    function __construct(
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
46
        Group $players,
47
        Console $console,
48
        Notifications $notifications,
49
        TotoWindowFactory $mlFactory,
50
        Time $time
51
    ) {
52
        $this->console = $console;
53
        $this->playersGroup = $players;
54
        $this->notifications = $notifications;
55
        $this->mlFactory = $mlFactory;
56
        $this->time = $time;
57
    }
58
59
    /**
60
     * Set the status of the plugin
61
     *
62
     * @param boolean $status
63
     *
64
     * @return null
65
     */
66
    public function setStatus($status)
67
    {
68
        if ($status) {
69
            $this->mlFactory->create($this->playersGroup);
70
        } else {
71
            $this->mlFactory->destroy($this->playersGroup);
72
        }
73
    }
74
75
    /**
76
     * called at eXpansion init
77
     *
78
     * @return void
79
     */
80
    public function onApplicationInit()
81
    {
82
        // do nothing
83
    }
84
85
    /**
86
     * called when init is done and callbacks are enabled
87
     *
88
     * @return void
89
     */
90
    public function onApplicationReady()
91
    {
92
93
    }
94
95
    /**
96
     * called when requesting application stop
97
     *
98
     * @return void
99
     */
100
    public function onApplicationStop()
101
    {
102
        // do nothing
103
    }
104
}
105