Completed
Pull Request — master (#95)
by
unknown
05:41
created

MemoryWidgetFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createContent() 0 10 1
A setMemory() 0 4 1
1
<?php
2
3
namespace eXpansion\Bundle\Acme\Plugins\Gui;
4
5
use eXpansion\Framework\Core\Model\Gui\ManialinkInterface;
6
use eXpansion\Framework\Core\Model\Gui\Widget;
7
use eXpansion\Framework\Core\Plugins\Gui\WidgetFactory;
8
use eXpansion\Framework\Core\Plugins\Gui\WindowFactory as BaseWindowFactory;
9
use eXpansion\Framework\Gui\Components\uiButton;
10
use eXpansion\Framework\Gui\Components\uiCheckbox;
11
use eXpansion\Framework\Gui\Components\uiDropdown;
12
use eXpansion\Framework\Gui\Components\uiLabel;
13
use eXpansion\Framework\Gui\Components\uiLine;
14
use eXpansion\Framework\Gui\Components\uiTooltip;
15
use eXpansion\Framework\Gui\Layouts\layoutLine;
16
use eXpansion\Framework\Gui\Layouts\layoutRow;
17
use FML\Controls\Label;
18
use FML\Controls\Quad;
19
20
class MemoryWidgetFactory extends WidgetFactory
21
{
22
23
    protected $memoryMessage = "";
24
25
    protected function createContent(ManialinkInterface $manialink)
26
    {
27
        parent::createContent($manialink);
28
        $this->memoryMessage = new Label();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \FML\Controls\Label() of type object<FML\Controls\Label> is incompatible with the declared type string of property $memoryMessage.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
29
        $this->memoryMessage->setTextPrefix('$s')->setText("waiting data...");
30
31
        $manialink->getContentFrame()->setScale(0.8)->setPosition(160, -130);
32
        $manialink->addChild($this->memoryMessage);
33
34
    }
35
36
    public function setMemory($msg)
37
    {
38
        $this->memoryMessage->setText($msg);
0 ignored issues
show
Bug introduced by
The method setText cannot be called on $this->memoryMessage (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
39
    }
40
41
}
42