1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the highcharts-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2017 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\HighchartsBundle\API\Chart; |
13
|
|
|
|
14
|
|
|
use JsonSerializable; |
15
|
|
|
use WBW\Library\Core\Utility\Argument\ArrayUtility; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Highcharts no data. |
19
|
|
|
* |
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
21
|
|
|
* @package WBW\Bundle\HighchartsBundle\API\Chart |
22
|
|
|
* @version 5.0.14 |
23
|
|
|
* @final |
24
|
|
|
*/ |
25
|
|
|
final class HighchartsNoData implements JsonSerializable { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Attr. |
29
|
|
|
* |
30
|
|
|
* @var array |
31
|
|
|
* @since 3.0.8 |
32
|
|
|
*/ |
33
|
|
|
private $attr; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Position. |
37
|
|
|
* |
38
|
|
|
* @var array |
39
|
|
|
* @since 3.0.8 |
40
|
|
|
*/ |
41
|
|
|
private $position = ["x" => 0, "y" => 0, "align" => "center", "verticalAlign" => "middle"]; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Style. |
45
|
|
|
* |
46
|
|
|
* @var array |
47
|
|
|
* @since 3.0.8 |
48
|
|
|
*/ |
49
|
|
|
private $style = ["fontSize" => "12px", "fontWeight" => "bold", "color" => "#666666"]; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Use HTML. |
53
|
|
|
* |
54
|
|
|
* @var boolean |
55
|
|
|
* @since 4.1.10 |
56
|
|
|
*/ |
57
|
|
|
private $useHTML = false; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Constructor. |
61
|
|
|
* |
62
|
|
|
* @param boolean $ignoreDefaultValues Ignore the default values. |
63
|
|
|
*/ |
64
|
|
|
public function __construct($ignoreDefaultValues = true) { |
65
|
|
|
if (true === $ignoreDefaultValues) { |
66
|
|
|
$this->clear(); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Clear. |
72
|
|
|
* |
73
|
|
|
* @return void |
74
|
|
|
*/ |
75
|
|
|
public function clear() { |
76
|
|
|
|
77
|
|
|
// Clear the attr. |
78
|
|
|
$this->attr = null; |
|
|
|
|
79
|
|
|
|
80
|
|
|
// Clear the position. |
81
|
|
|
$this->position = null; |
|
|
|
|
82
|
|
|
|
83
|
|
|
// Clear the style. |
84
|
|
|
$this->style = null; |
|
|
|
|
85
|
|
|
|
86
|
|
|
// Clear the use HTML. |
87
|
|
|
$this->useHTML = null; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Get the attr. |
92
|
|
|
* |
93
|
|
|
* @return array Returns the attr. |
94
|
|
|
*/ |
95
|
|
|
public function getAttr() { |
96
|
|
|
return $this->attr; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Get the position. |
101
|
|
|
* |
102
|
|
|
* @return array Returns the position. |
103
|
|
|
*/ |
104
|
|
|
public function getPosition() { |
105
|
|
|
return $this->position; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Get the style. |
110
|
|
|
* |
111
|
|
|
* @return array Returns the style. |
112
|
|
|
*/ |
113
|
|
|
public function getStyle() { |
114
|
|
|
return $this->style; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Get the use HTML. |
119
|
|
|
* |
120
|
|
|
* @return boolean Returns the use HTML. |
121
|
|
|
*/ |
122
|
|
|
public function getUseHTML() { |
123
|
|
|
return $this->useHTML; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Serialize this instance. |
128
|
|
|
* |
129
|
|
|
* @return array Returns an array representing this instance. |
130
|
|
|
*/ |
131
|
|
|
public function jsonSerialize() { |
132
|
|
|
return $this->toArray(); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Set the attr. |
137
|
|
|
* |
138
|
|
|
* @param array $attr The attr. |
139
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsNoData Returns the highcharts no data. |
140
|
|
|
*/ |
141
|
|
|
public function setAttr(array $attr = null) { |
142
|
|
|
$this->attr = $attr; |
|
|
|
|
143
|
|
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Set the position. |
148
|
|
|
* |
149
|
|
|
* @param array $position The position. |
150
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsNoData Returns the highcharts no data. |
151
|
|
|
*/ |
152
|
|
|
public function setPosition(array $position = null) { |
153
|
|
|
$this->position = $position; |
|
|
|
|
154
|
|
|
return $this; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Set the style. |
159
|
|
|
* |
160
|
|
|
* @param array $style The style. |
161
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsNoData Returns the highcharts no data. |
162
|
|
|
*/ |
163
|
|
|
public function setStyle(array $style = null) { |
164
|
|
|
$this->style = $style; |
|
|
|
|
165
|
|
|
return $this; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* Set the use HTML. |
170
|
|
|
* |
171
|
|
|
* @param boolean $useHTML The use HTML. |
172
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsNoData Returns the highcharts no data. |
173
|
|
|
*/ |
174
|
|
|
public function setUseHTML($useHTML) { |
175
|
|
|
$this->useHTML = $useHTML; |
176
|
|
|
return $this; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* Convert into an array representing this instance. |
181
|
|
|
* |
182
|
|
|
* @return array Returns an array representing this instance. |
183
|
|
|
*/ |
184
|
|
|
public function toArray() { |
185
|
|
|
|
186
|
|
|
// Initialize the output. |
187
|
|
|
$output = []; |
188
|
|
|
|
189
|
|
|
// Set the attr. |
190
|
|
|
ArrayUtility::set($output, "attr", $this->attr, [null]); |
191
|
|
|
|
192
|
|
|
// Set the position. |
193
|
|
|
ArrayUtility::set($output, "position", $this->position, [null]); |
194
|
|
|
|
195
|
|
|
// Set the style. |
196
|
|
|
ArrayUtility::set($output, "style", $this->style, [null]); |
197
|
|
|
|
198
|
|
|
// Set the use HTML. |
199
|
|
|
ArrayUtility::set($output, "useHTML", $this->useHTML, [null]); |
200
|
|
|
|
201
|
|
|
// Return the output. |
202
|
|
|
return $output; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
} |
206
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..