/
TypeValue.php
144 lines (122 loc) · 3.83 KB
/
TypeValue.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
namespace Concrete\Core\StyleCustomizer\Style\Value;
class TypeValue extends Value
{
protected $fontFamily = -1;
protected $fontSize = -1;
protected $color = -1;
protected $lineHeight = -1;
protected $letterSpacing = -1;
protected $fontStyle = -1;
protected $fontWeight = -1;
protected $textDecoration = -1;
protected $textTransform = -1;
public function setFontFamily($fontFamily)
{
$this->fontFamily = $fontFamily;
}
public function setFontStyle($fontStyle)
{
$this->fontStyle = $fontStyle;
}
public function setFontSize(\Concrete\Core\StyleCustomizer\Style\Value\SizeValue $fontSize)
{
$this->fontSize = $fontSize;
}
public function setColor(\Concrete\Core\StyleCustomizer\Style\Value\ColorValue $color)
{
$this->color = $color;
}
public function setFontWeight($fontWeight)
{
$this->fontWeight = $fontWeight;
}
public function setTextDecoration($textDecoration)
{
$this->textDecoration = $textDecoration;
}
public function setTextTransform($textTransform)
{
$this->textTransform = $textTransform;
}
public function setLineHeight(\Concrete\Core\StyleCustomizer\Style\Value\SizeValue $lineHeight)
{
$this->lineHeight = $lineHeight;
}
public function setLetterSpacing(\Concrete\Core\StyleCustomizer\Style\Value\SizeValue $letterSpacing)
{
$this->letterSpacing = $letterSpacing;
}
public function getFontFamily()
{
return $this->fontFamily;
}
public function getFontSize()
{
return $this->fontSize;
}
public function getFontWeight()
{
return $this->fontWeight;
}
public function getColor()
{
return $this->color;
}
public function getTextDecoration()
{
return $this->textDecoration;
}
public function getTextTransform()
{
return $this->textTransform;
}
public function getFontStyle()
{
return $this->fontStyle;
}
public function getLetterSpacing()
{
return $this->letterSpacing;
}
public function getLineHeight()
{
return $this->lineHeight;
}
public function toStyleString()
{
return '';
}
public function toLessVariablesArray()
{
$variables = array();
if ($this->getFontFamily() != -1) {
$variables[$this->getVariable() . '-type-font-family'] = $this->getFontFamily();
}
if (is_object($this->color)) {
$variables[$this->getVariable() . '-type-color'] = $this->color->toStyleString();
}
if ($this->getTextDecoration() != -1) {
$variables[$this->getVariable() . '-type-text-decoration'] = $this->getTextDecoration();
}
if ($this->getTextTransform() != -1) {
$variables[$this->getVariable() . '-type-text-transform'] = $this->getTextTransform();
}
if ($this->getFontStyle() != -1) {
$variables[$this->getVariable() . '-type-font-style'] = $this->getFontStyle();
}
if ($this->getFontWeight() != -1) {
$variables[$this->getVariable() . '-type-font-weight'] = $this->getFontWeight();
}
if (is_object($this->fontSize) && $this->fontSize->getSize()) {
$variables[$this->getVariable() . '-type-font-size'] = $this->fontSize->toStyleString();
}
if (is_object($this->lineHeight) && $this->lineHeight->getSize()) {
$variables[$this->getVariable() . '-type-line-height'] = $this->lineHeight->toStyleString();
}
if (is_object($this->letterSpacing) && $this->letterSpacing->getSize()) {
$variables[$this->getVariable() . '-type-letter-spacing'] = $this->letterSpacing->toStyleString();
}
return $variables;
}
}