Completed
Branch master (220ce5)
by De Cramer
16:11
created

Manialink   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 102
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 68%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 102
ccs 17
cts 25
cp 0.68
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 1
A getXml() 0 7 1
A getUserGroup() 0 4 1
A getId() 0 4 1
A addChild() 0 3 1
A getChildren() 0 3 1
A removeChild() 0 4 1
A getContentFrame() 0 3 1
1
<?php
2
3
namespace eXpansion\Framework\Core\Model\Gui;
4
5
use eXpansion\Framework\Core\Model\Data\DataStorageTrait;
6
use eXpansion\Framework\Core\Model\UserGroups\Group;
7
use FML\Types\Renderable;
8
9
class Manialink implements ManialinkInterface
10
{
11
    use DataStorageTrait;
12
13
    /** @var string */
14
    protected $id;
15
16
    /** @var string */
17
    protected $name;
18
19
    /** @var  Group */
20
    protected $group;
21
22
    /** @var float */
23
    protected $sizeX;
24
25
    /** @var float */
26
    protected $sizeY;
27
28
    /** @var float */
29
    protected $posX;
30
31
    /** @var float */
32
    protected $posY;
33
34
    /**
35
     * Manialive constructor.
36
     * @param Group $group
37
     */
38 21
    public function __construct(
39
        Group $group,
40
        $name,
41
        $sizeX,
42
        $sizeY,
43
        $posX = null,
44
        $posY = null
45
    ) {
46 21
        $this->group = $group;
47 21
        $this->name = $name;
48 21
        $this->sizeX = $sizeX;
49 21
        $this->sizeY = $sizeY;
50 21
        $this->posX = $posX;
51 21
        $this->posY = $posY;
52 21
        $this->id = uniqid("ml_", true); // originally: $this->id = spl_object_hash($this)... change back if needed
53 21
    }
54
55
    /**
56
     *
57
     * @return string
58
     */
59 10
    public function getXml()
60
    {
61
        return '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>'
62 10
            .'<manialink version="3" id="'.$this->getId().'">'
63 10
            .'<label text="Hello World!" />'
64 10
            .'</manialink>';
65
    }
66
67
    /**
68
     *
69
     * @return Group
70
     */
71 11
    public function getUserGroup()
72
    {
73 11
        return $this->group;
74
    }
75
76
    /**
77
     *
78
     * @return string
79
     */
80 16
    public function getId()
81
    {
82 16
        return $this->id;
83
    }
84
85
    /**
86
     * @inheritdoc
87
     */
88
    public function addChild(Renderable $child)
89
    {
90
    }
91
92
    /**
93
     * @inheritdoc
94
     */
95
    public function getChildren()
96
    {
97
    }
98
99
    public function removeChild(Renderable $child)
100
    {
101
102
    }
103
104
    /**
105
     * @inheritdoc
106
     */
107
    public function getContentFrame()
108
    {
109
    }
110
}
111