Completed
Pull Request — master (#161)
by De Cramer
02:59
created

abstractUiElement::getVerticalAlign()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace eXpansion\Framework\Gui\Components;
4
5
use FML\Script\Features\ScriptFeature;
6
use FML\Types\Renderable;
7
8
abstract class abstractUiElement extends ScriptFeature implements Renderable
9
{
10
    protected $_classes = [];
11
    protected $_dataAttributes = [];
12
    protected $posX = 0;
13
    protected $posY = 0;
14
    protected $posZ = 0;
15
16
    protected $width = 1;
17
    protected $height = 1;
18
    protected $horizontalAlign = "left";
19
    protected $verticalAlign = "top";
20
21
    /**
22
     * @param int $posX
23
     * @param int $posY
24
     * @param int $posZ
25
     */
26
    public function setPosition($posX = 0, $posY = 0, $posZ = 0)
27
    {
28
        $this->posX = $posX;
29
        $this->posY = $posY;
30
        $this->posZ = $posZ;
31
32
        return $this;
33
34
    }
35
36
    public function setX($X)
37
    {
38
        $this->posX = $X;
39
40
        return $this;
41
    }
42
43
    public function setY($Y)
44
    {
45
        $this->posY = $Y;
46
47
        return $this;
48
    }
49
50
    public function setZ($Z)
51
    {
52
        $this->posZ = $Z;
53
54
        return $this;
55
    }
56
57
    /**
58
     * Render the XML element
59
     *
60
     * @param \DOMDocument $domDocument DOMDocument for which the XML element should be rendered
61
     * @return \DOMElement
62
     */
63
    abstract public function render(\DOMDocument $domDocument);
64
65
    /**
66
     * @return int
67
     */
68
    public function getX()
69
    {
70
        return $this->posX;
71
    }
72
73
    /**
74
     * @return int
75
     */
76
    public function getY()
77
    {
78
        return $this->posY;
79
    }
80
81
    /**
82
     * @return int
83
     */
84
    public function getZ()
85
    {
86
        return $this->posZ;
87
    }
88
89
    /**
90
     * @return mixed
91
     */
92
    public function getWidth()
93
    {
94
        return $this->width;
95
    }
96
97
    /**
98
     * @param mixed $width
99
     */
100
    public function setWidth($width)
101
    {
102
        $this->width = $width;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @param mixed $height
109
     * @return abstractUiElement
110
     */
111
    public function setHeight($height)
112
    {
113
        $this->height = $height;
114
115
        return $this;
116
    }
117
118
    /**
119
     * @return mixed
120
     */
121
    public function getHeight()
122
    {
123
        return $this->height;
124
    }
125
126
    public function setSize($x, $y)
127
    {
128
        $this->width = $x;
129
        $this->height = $y;
130
131
        return $this;
132
    }
133
134
    public function addDataAttribute($name, $value)
135
    {
136
        $this->_dataAttributes[$name] = $value;
137
138
        return $this;
139
    }
140
141
    public function addClass($name)
142
    {
143
        $this->_classes[] = $name;
144
145
        return $this;
146
    }
147
148
    /**
149
     * @return string
150
     */
151
    public function getHorizontalAlign(): string
152
    {
153
        return $this->horizontalAlign;
154
    }
155
156
    /**
157
     * @param string $horizontalAlign
158
     */
159
    public function setHorizontalAlign(string $horizontalAlign)
160
    {
161
        $this->horizontalAlign = $horizontalAlign;
162
163
        return $this;
164
    }
165
166
    /**
167
     * @return string
168
     */
169
    public function getVerticalAlign(): string
170
    {
171
        return $this->verticalAlign;
172
    }
173
174
    /**
175
     * @param string $verticalAlign
176
     */
177
    public function setVerticalAlign(string $verticalAlign)
178
    {
179
        $this->verticalAlign = $verticalAlign;
180
181
        return $this;
182
    }
183
184
}
185