Completed
Pull Request — master (#28)
by De Cramer
02:19
created

Manialink   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 74
rs 10
c 0
b 0
f 0
ccs 17
cts 17
cp 1

4 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
1
<?php
2
3
namespace eXpansion\Core\Model\Gui;
4
5
use eXpansion\Core\Model\UserGroups\Group;
6
7
class Manialink implements ManialinkInerface
8
{
9
    /** @var string  */
10
    protected $id;
11
12
    /** @var string */
13
    protected $name;
14
15
    /** @var  Group */
16
    protected $group;
17
18
    /** @var float */
19
    protected $sizeX;
20
21
    /** @var float */
22
    protected $sizeY;
23
24
    /** @var float */
25
    protected $posX;
26
27
    /** @var float */
28
    protected $posY;
29
30
    /**
31
     * Manialive constructor.
32
     * @param Group $group
33
     */
34 14
    public function __construct(
35
        Group $group,
36
        $name,
37
        $sizeX,
38
        $sizeY,
39
        $posX = null,
40
        $posY = null
41
    ) {
42 14
        $this->group = $group;
43 14
        $this->name = $name;
44 14
        $this->sizeX = $sizeX;
45 14
        $this->sizeY = $sizeY;
46 14
        $this->posX = $posX;
47 14
        $this->posY = $posY;
48 14
        $this->id = spl_object_hash($this);
49 14
    }
50
51
    /**
52
     *
53
     * @return string
54
     */
55 8
    public function getXml()
56
    {
57
        return '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>'
58 8
                .'<manialink version="3" id="' . $this->getId() . '">'
59 8
                    .'<label text="Hello World!" />'
60 8
                .'</manialink>';
61
    }
62
63
    /**
64
     *
65
     * @return Group
66
     */
67 9
    public function getUserGroup()
68
    {
69 9
        return $this->group;
70
    }
71
72
    /**
73
     *
74
     * @return string
75
     */
76 9
    public function getId()
77
    {
78 9
        return $this->id;
79
    }
80
}