Completed
Pull Request — master (#75)
by
unknown
07:18
created

Maps   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 69
ccs 0
cts 25
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A setStatus() 0 6 2
A getMaps() 0 4 1
A onMapListModified() 0 4 1
A onExpansionMapChange() 0 4 1
A onExpansionNextMapChange() 0 4 1
1
<?php
2
3
namespace eXpansion\Bundle\Maps\Plugins;
4
5
use eXpansion\Framework\AdminGroups\Helpers\AdminGroups;
6
use eXpansion\Framework\Core\DataProviders\Listener\MapDataListenerInterface;
7
use eXpansion\Framework\Core\Plugins\StatusAwarePluginInterface;
8
use eXpansion\Framework\Core\Services\Console;
9
use eXpansion\Framework\Core\Storage\MapStorage;
10
use Maniaplanet\DedicatedServer\Connection;
11
12
13
class Maps implements MapDataListenerInterface, StatusAwarePluginInterface
14
{
15
    /** @var Connection */
16
    protected $connection;
17
18
    /** @var Console */
19
    protected $console;
20
21
    /** @var AdminGroups */
22
    protected $adminGroups;
23
24
    /** @var bool */
25
    protected $enabled = true;
26
27
    /** @var MapStorage */
28
    protected $mapStorage;
29
30
    function __construct(Connection $connection, Console $console, AdminGroups $adminGroups, MapStorage $mapStorage)
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...
31
    {
32
        $this->connection = $connection;
33
        $this->console = $console;
34
        $this->adminGroups = $adminGroups;
35
        $this->mapStorage = $mapStorage;
36
    }
37
38
    /**
39
     * Set the status of the plugin
40
     *
41
     * @param boolean $status
42
     *
43
     * @return void
44
     */
45
    public function setStatus($status)
46
    {
47
        if (!$status) {
0 ignored issues
show
Unused Code introduced by
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
48
49
        }
50
    }
51
52
    /**
53
     * @return array
54
     */
55
    public function getMaps()
56
    {
57
        return $this->mapStorage->getMaps();
58
    }
59
60
    /**
61
     * @param \Maniaplanet\DedicatedServer\Structures\Map[] $oldMaps
62
     * @param string $currentMapUid
63
     * @param string $nextMapUid
64
     * @param bool $isListModified
65
     * @return mixed|void
66
     */
67
    public function onMapListModified($oldMaps, $currentMapUid, $nextMapUid, $isListModified)
68
    {
69
70
    }
71
72
    public function onExpansionMapChange($currentMap, $previousMap)
73
    {
74
        // TODO: Implement onExpansionMapChange() method.
75
    }
76
77
    public function onExpansionNextMapChange($nextMap, $previousNextMap)
78
    {
79
        // TODO: Implement onExpansionNextMapChange() method.
80
    }
81
}
82