Completed
Pull Request — master (#75)
by
unknown
02:24
created

Manialink   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 73.91%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 97
rs 10
c 0
b 0
f 0
ccs 17
cts 23
cp 0.7391

7 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 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 20
    public function __construct(
39
        Group $group,
40
        $name,
41
        $sizeX,
42
        $sizeY,
43
        $posX = null,
44
        $posY = null
45
    ) {
46 20
        $this->group = $group;
47 20
        $this->name = $name;
48 20
        $this->sizeX = $sizeX;
49 20
        $this->sizeY = $sizeY;
50 20
        $this->posX = $posX;
51 20
        $this->posY = $posY;
52 20
        $this->id = spl_object_hash($this);
53 20
    }
54
55
    /**
56
     *
57
     * @return string
58
     */
59 9
    public function getXml()
60
    {
61
        return '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>'
62 9
            .'<manialink version="3" id="'.$this->getId().'">'
63 9
            .'<label text="Hello World!" />'
64 9
            .'</manialink>';
65
    }
66
67
    /**
68
     *
69
     * @return Group
70
     */
71 10
    public function getUserGroup()
72
    {
73 10
        return $this->group;
74
    }
75
76
    /**
77
     *
78
     * @return string
79
     */
80 15
    public function getId()
81
    {
82 15
        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
    /**
100
     * @inheritdoc
101
     */
102
    public function getContentFrame()
103
    {
104
    }
105
}
106