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\XAxis; |
13
|
|
|
|
14
|
|
|
use JsonSerializable; |
15
|
|
|
use WBW\Library\Core\Utility\Argument\ArrayUtility; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Highcharts plot bands. |
19
|
|
|
* |
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
21
|
|
|
* @package WBW\Bundle\HighchartsBundle\API\Chart\XAxis |
22
|
|
|
* @version 5.0.14 |
23
|
|
|
* @final |
24
|
|
|
*/ |
25
|
|
|
final class HighchartsPlotBands implements JsonSerializable { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Border color. |
29
|
|
|
* |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
private $borderColor; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Border width. |
36
|
|
|
* |
37
|
|
|
* @var integer |
38
|
|
|
*/ |
39
|
|
|
private $borderWidth = 0; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Class name. |
43
|
|
|
* |
44
|
|
|
* @var string |
45
|
|
|
* @since 5.0.0 |
46
|
|
|
*/ |
47
|
|
|
private $className; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Color. |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
private $color; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Events. |
58
|
|
|
* |
59
|
|
|
* @var array |
60
|
|
|
* @since 1.2 |
61
|
|
|
*/ |
62
|
|
|
private $events; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* From. |
66
|
|
|
* |
67
|
|
|
* @var integer |
68
|
|
|
*/ |
69
|
|
|
private $from; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Id. |
73
|
|
|
* |
74
|
|
|
* @var string |
75
|
|
|
*/ |
76
|
|
|
private $id; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Label. |
80
|
|
|
* |
81
|
|
|
* @var \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\PlotBands\HighchartsLabel |
82
|
|
|
*/ |
83
|
|
|
private $label; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* To. |
87
|
|
|
* |
88
|
|
|
* @var integer |
89
|
|
|
*/ |
90
|
|
|
private $to; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Z index. |
94
|
|
|
* |
95
|
|
|
* @var integer |
96
|
|
|
* @since 1.2 |
97
|
|
|
*/ |
98
|
|
|
private $zIndex; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Constructor. |
102
|
|
|
* |
103
|
|
|
* @param boolean $ignoreDefaultValues Ignore the default values. |
104
|
|
|
*/ |
105
|
|
|
public function __construct($ignoreDefaultValues = true) { |
106
|
|
|
if (true === $ignoreDefaultValues) { |
107
|
|
|
$this->clear(); |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Clear. |
113
|
|
|
* |
114
|
|
|
* @return void |
115
|
|
|
*/ |
116
|
|
|
public function clear() { |
117
|
|
|
|
118
|
|
|
// Clear the border color. |
119
|
|
|
$this->borderColor = null; |
120
|
|
|
|
121
|
|
|
// Clear the border width. |
122
|
|
|
$this->borderWidth = null; |
123
|
|
|
|
124
|
|
|
// Clear the class name. |
125
|
|
|
$this->className = null; |
126
|
|
|
|
127
|
|
|
// Clear the color. |
128
|
|
|
$this->color = null; |
129
|
|
|
|
130
|
|
|
// Clear the events. |
131
|
|
|
$this->events = null; |
|
|
|
|
132
|
|
|
|
133
|
|
|
// Clear the from. |
134
|
|
|
$this->from = null; |
135
|
|
|
|
136
|
|
|
// Clear the id. |
137
|
|
|
$this->id = null; |
138
|
|
|
|
139
|
|
|
// Clear the label. |
140
|
|
|
if (null !== $this->label) { |
141
|
|
|
$this->label->clear(); |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
// Clear the to. |
145
|
|
|
$this->to = null; |
146
|
|
|
|
147
|
|
|
// Clear the z index. |
148
|
|
|
$this->zIndex = null; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Get the border color. |
153
|
|
|
* |
154
|
|
|
* @return string Returns the border color. |
155
|
|
|
*/ |
156
|
|
|
public function getBorderColor() { |
157
|
|
|
return $this->borderColor; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Get the border width. |
162
|
|
|
* |
163
|
|
|
* @return integer Returns the border width. |
164
|
|
|
*/ |
165
|
|
|
public function getBorderWidth() { |
166
|
|
|
return $this->borderWidth; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* Get the class name. |
171
|
|
|
* |
172
|
|
|
* @return string Returns the class name. |
173
|
|
|
*/ |
174
|
|
|
public function getClassName() { |
175
|
|
|
return $this->className; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Get the color. |
180
|
|
|
* |
181
|
|
|
* @return string Returns the color. |
182
|
|
|
*/ |
183
|
|
|
public function getColor() { |
184
|
|
|
return $this->color; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Get the events. |
189
|
|
|
* |
190
|
|
|
* @return array Returns the events. |
191
|
|
|
*/ |
192
|
|
|
public function getEvents() { |
193
|
|
|
return $this->events; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Get the from. |
198
|
|
|
* |
199
|
|
|
* @return integer Returns the from. |
200
|
|
|
*/ |
201
|
|
|
public function getFrom() { |
202
|
|
|
return $this->from; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* Get the id. |
207
|
|
|
* |
208
|
|
|
* @return string Returns the id. |
209
|
|
|
*/ |
210
|
|
|
public function getId() { |
211
|
|
|
return $this->id; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Get the label. |
216
|
|
|
* |
217
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\PlotBands\HighchartsLabel Returns the label. |
218
|
|
|
*/ |
219
|
|
|
public function getLabel() { |
220
|
|
|
return $this->label; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* Get the to. |
225
|
|
|
* |
226
|
|
|
* @return integer Returns the to. |
227
|
|
|
*/ |
228
|
|
|
public function getTo() { |
229
|
|
|
return $this->to; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* Get the z index. |
234
|
|
|
* |
235
|
|
|
* @return integer Returns the z index. |
236
|
|
|
*/ |
237
|
|
|
public function getZIndex() { |
238
|
|
|
return $this->zIndex; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* Serialize this instance. |
243
|
|
|
* |
244
|
|
|
* @return array Returns an array representing this instance. |
245
|
|
|
*/ |
246
|
|
|
public function jsonSerialize() { |
247
|
|
|
return $this->toArray(); |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* Create a new label. |
252
|
|
|
* |
253
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\PlotBands\HighchartsLabel Returns the label. |
254
|
|
|
*/ |
255
|
|
|
public function newLabel() { |
256
|
|
|
$this->label = new \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\PlotBands\HighchartsLabel(); |
257
|
|
|
return $this->label; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* Set the border color. |
262
|
|
|
* |
263
|
|
|
* @param string $borderColor The border color. |
264
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
265
|
|
|
*/ |
266
|
|
|
public function setBorderColor($borderColor) { |
267
|
|
|
$this->borderColor = $borderColor; |
268
|
|
|
return $this; |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* Set the border width. |
273
|
|
|
* |
274
|
|
|
* @param integer $borderWidth The border width. |
275
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
276
|
|
|
*/ |
277
|
|
|
public function setBorderWidth($borderWidth) { |
278
|
|
|
$this->borderWidth = $borderWidth; |
279
|
|
|
return $this; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
/** |
283
|
|
|
* Set the class name. |
284
|
|
|
* |
285
|
|
|
* @param string $className The class name. |
286
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
287
|
|
|
*/ |
288
|
|
|
public function setClassName($className) { |
289
|
|
|
$this->className = $className; |
290
|
|
|
return $this; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* Set the color. |
295
|
|
|
* |
296
|
|
|
* @param string $color The color. |
297
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
298
|
|
|
*/ |
299
|
|
|
public function setColor($color) { |
300
|
|
|
$this->color = $color; |
301
|
|
|
return $this; |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* Set the events. |
306
|
|
|
* |
307
|
|
|
* @param array $events The events. |
308
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
309
|
|
|
*/ |
310
|
|
|
public function setEvents(array $events = null) { |
311
|
|
|
$this->events = $events; |
|
|
|
|
312
|
|
|
return $this; |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* Set the from. |
317
|
|
|
* |
318
|
|
|
* @param integer $from The from. |
319
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
320
|
|
|
*/ |
321
|
|
|
public function setFrom($from) { |
322
|
|
|
$this->from = $from; |
323
|
|
|
return $this; |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
/** |
327
|
|
|
* Set the id. |
328
|
|
|
* |
329
|
|
|
* @param string $id The id. |
330
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
331
|
|
|
*/ |
332
|
|
|
public function setId($id) { |
333
|
|
|
$this->id = $id; |
334
|
|
|
return $this; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* Set the label. |
339
|
|
|
* |
340
|
|
|
* @param \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\PlotBands\HighchartsLabel $label The label. |
341
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
342
|
|
|
*/ |
343
|
|
|
public function setLabel(\WBW\Bundle\HighchartsBundle\API\Chart\XAxis\PlotBands\HighchartsLabel $label = null) { |
344
|
|
|
$this->label = $label; |
345
|
|
|
return $this; |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
/** |
349
|
|
|
* Set the to. |
350
|
|
|
* |
351
|
|
|
* @param integer $to The to. |
352
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
353
|
|
|
*/ |
354
|
|
|
public function setTo($to) { |
355
|
|
|
$this->to = $to; |
356
|
|
|
return $this; |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
/** |
360
|
|
|
* Set the z index. |
361
|
|
|
* |
362
|
|
|
* @param integer $zIndex The z index. |
363
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\HighchartsPlotBands Returns the highcharts plot bands. |
364
|
|
|
*/ |
365
|
|
|
public function setZIndex($zIndex) { |
366
|
|
|
$this->zIndex = $zIndex; |
367
|
|
|
return $this; |
368
|
|
|
} |
369
|
|
|
|
370
|
|
|
/** |
371
|
|
|
* Convert into an array representing this instance. |
372
|
|
|
* |
373
|
|
|
* @return array Returns an array representing this instance. |
374
|
|
|
*/ |
375
|
|
|
public function toArray() { |
376
|
|
|
|
377
|
|
|
// Initialize the output. |
378
|
|
|
$output = []; |
379
|
|
|
|
380
|
|
|
// Set the border color. |
381
|
|
|
ArrayUtility::set($output, "borderColor", $this->borderColor, [null]); |
382
|
|
|
|
383
|
|
|
// Set the border width. |
384
|
|
|
ArrayUtility::set($output, "borderWidth", $this->borderWidth, [null]); |
385
|
|
|
|
386
|
|
|
// Set the class name. |
387
|
|
|
ArrayUtility::set($output, "className", $this->className, [null]); |
388
|
|
|
|
389
|
|
|
// Set the color. |
390
|
|
|
ArrayUtility::set($output, "color", $this->color, [null]); |
391
|
|
|
|
392
|
|
|
// Set the events. |
393
|
|
|
ArrayUtility::set($output, "events", $this->events, [null]); |
394
|
|
|
|
395
|
|
|
// Set the from. |
396
|
|
|
ArrayUtility::set($output, "from", $this->from, [null]); |
397
|
|
|
|
398
|
|
|
// Set the id. |
399
|
|
|
ArrayUtility::set($output, "id", $this->id, [null]); |
400
|
|
|
|
401
|
|
|
// Set the label. |
402
|
|
|
if (null !== $this->label) { |
403
|
|
|
ArrayUtility::set($output, "label", $this->label->toArray(), []); |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
// Set the to. |
407
|
|
|
ArrayUtility::set($output, "to", $this->to, [null]); |
408
|
|
|
|
409
|
|
|
// Set the z index. |
410
|
|
|
ArrayUtility::set($output, "zIndex", $this->zIndex, [null]); |
411
|
|
|
|
412
|
|
|
// Return the output. |
413
|
|
|
return $output; |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
} |
417
|
|
|
|
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..