Completed
Pull Request — master (#194)
by De Cramer
24:15 queued 02:45
created

CustomScoreboardWidget   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A createContent() 0 20 1
1
<?php
2
3
namespace eXpansion\Bundle\CustomUi\Plugins\Gui;
4
5
use eXpansion\Framework\Core\Model\Gui\ManialinkInterface;
6
use eXpansion\Framework\Core\Model\Gui\Widget;
7
use eXpansion\Framework\Core\Model\Gui\WidgetFactoryContext;
8
use eXpansion\Framework\Core\Plugins\Gui\WidgetFactory;
9
use eXpansion\Framework\Core\Services\Application\Dispatcher;
10
use eXpansion\Framework\Core\Storage\PlayerStorage;
11
use FML\Script\ScriptLabel;
12
13
class CustomScoreboardWidget extends WidgetFactory
14
{
15
16
    /**
17
     * ChatHelperWidget constructor.
18
     * @param                      $name
19
     * @param                      $sizeX
20
     * @param                      $sizeY
21
     * @param                      $posX
22
     * @param                      $posY
23
     * @param WidgetFactoryContext $context
24
     * @param Dispatcher           $dispatcher
0 ignored issues
show
Bug introduced by
There is no parameter named $dispatcher. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
25
     * @param PlayerStorage        $playerStorage
0 ignored issues
show
Bug introduced by
There is no parameter named $playerStorage. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
26
     */
27
    public function __construct(
28
        $name,
29
        $sizeX,
30
        $sizeY,
31
        $posX,
32
        $posY,
33
        WidgetFactoryContext $context
34
    ) {
35
        parent::__construct($name, $sizeX, $sizeY, $posX, $posY, $context);
36
    }
37
38
39
    /**
40
     * @param ManialinkInterface|Widget $manialink
41
     */
42
    protected function createContent(ManialinkInterface $manialink)
43
    {
44
        parent::createContent($manialink);
45
46
        $manialink->getFmlManialink()->getScript()->addCustomScriptLabel(ScriptLabel::OnInit, <<<EOL
47
            ClientUI.ScoreTableOnlyManialink = True;            
48
            ClientUI.ScoreTable = """
49
            <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
50
            <manialink version="3">
51
                <quad pos="0 50" z-index="0" size="140 20" bgcolor="FFFA" halign="center"/>
52
            </manialink>            
53
            """;
54
                        
55
EOL
56
        );
57
58
59
60
61
    }
62
63
64
}
65