Completed
Pull Request — master (#1)
by
unknown
17:16
created

HighchartsData::getX()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\Series\Boxplot;
13
14
use JsonSerializable;
15
use WBW\Library\Core\Utility\Argument\ArrayUtility;
16
17
/**
18
 * Highcharts data.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot
22
 * @version 5.0.14
23
 * @final
24
 */
25
final class HighchartsData implements JsonSerializable {
26
27
    /**
28
     * Class name.
29
     *
30
     * @var string
31
     * @since 5.0.0
32
     */
33
    private $className;
34
35
    /**
36
     * Color.
37
     *
38
     * @var string
39
     */
40
    private $color;
41
42
    /**
43
     * Color index.
44
     *
45
     * @var integer
46
     * @since 5.0.0
47
     */
48
    private $colorIndex;
49
50
    /**
51
     * Data labels.
52
     *
53
     * @var array
54
     */
55
    private $dataLabels;
56
57
    /**
58
     * Description.
59
     *
60
     * @var string
61
     * @since 5.0.0
62
     */
63
    private $description;
64
65
    /**
66
     * Drilldown.
67
     *
68
     * @var string
69
     * @since 3.0.8
70
     */
71
    private $drilldown;
72
73
    /**
74
     * Events.
75
     *
76
     * @var \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\Data\HighchartsEvents
77
     */
78
    private $events;
79
80
    /**
81
     * High.
82
     *
83
     * @var integer
84
     */
85
    private $high;
86
87
    /**
88
     * Id.
89
     *
90
     * @var string
91
     * @since 1.2.0
92
     */
93
    private $id;
94
95
    /**
96
     * Labelrank.
97
     *
98
     * @var integer
99
     */
100
    private $labelrank;
101
102
    /**
103
     * Low.
104
     *
105
     * @var integer
106
     */
107
    private $low;
108
109
    /**
110
     * Median.
111
     *
112
     * @var integer
113
     */
114
    private $median;
115
116
    /**
117
     * Name.
118
     *
119
     * @var string
120
     */
121
    private $name;
122
123
    /**
124
     * Q1.
125
     *
126
     * @var integer
127
     */
128
    private $q1;
129
130
    /**
131
     * Q3.
132
     *
133
     * @var integer
134
     */
135
    private $q3;
136
137
    /**
138
     * Selected.
139
     *
140
     * @var boolean
141
     */
142
    private $selected = false;
143
144
    /**
145
     * X.
146
     *
147
     * @var integer
148
     */
149
    private $x;
150
151
    /**
152
     * Y.
153
     *
154
     * @var integer
155
     */
156
    private $y;
157
158
    /**
159
     * Constructor.
160
     *
161
     * @param boolean $ignoreDefaultValues Ignore the default values.
162
     */
163
    public function __construct($ignoreDefaultValues = true) {
164
        if (true === $ignoreDefaultValues) {
165
            $this->clear();
166
        }
167
    }
168
169
    /**
170
     * Clear.
171
     *
172
     * @return void
173
     */
174
    public function clear() {
175
176
        // Clear the class name.
177
        $this->className = null;
178
179
        // Clear the color.
180
        $this->color = null;
181
182
        // Clear the color index.
183
        $this->colorIndex = null;
184
185
        // Clear the data labels.
186
        $this->dataLabels = null;
0 ignored issues
show
Documentation Bug introduced by
It seems like null of type null is incompatible with the declared type array of property $dataLabels.

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..

Loading history...
187
188
        // Clear the description.
189
        $this->description = null;
190
191
        // Clear the drilldown.
192
        $this->drilldown = null;
193
194
        // Clear the events.
195
        if (null !== $this->events) {
196
            $this->events->clear();
197
        }
198
199
        // Clear the high.
200
        $this->high = null;
201
202
        // Clear the id.
203
        $this->id = null;
204
205
        // Clear the labelrank.
206
        $this->labelrank = null;
207
208
        // Clear the low.
209
        $this->low = null;
210
211
        // Clear the median.
212
        $this->median = null;
213
214
        // Clear the name.
215
        $this->name = null;
216
217
        // Clear the q1.
218
        $this->q1 = null;
219
220
        // Clear the q3.
221
        $this->q3 = null;
222
223
        // Clear the selected.
224
        $this->selected = null;
225
226
        // Clear the x.
227
        $this->x = null;
228
229
        // Clear the y.
230
        $this->y = null;
231
    }
232
233
    /**
234
     * Get the class name.
235
     *
236
     * @return string Returns the class name.
237
     */
238
    public function getClassName() {
239
        return $this->className;
240
    }
241
242
    /**
243
     * Get the color.
244
     *
245
     * @return string Returns the color.
246
     */
247
    public function getColor() {
248
        return $this->color;
249
    }
250
251
    /**
252
     * Get the color index.
253
     *
254
     * @return integer Returns the color index.
255
     */
256
    public function getColorIndex() {
257
        return $this->colorIndex;
258
    }
259
260
    /**
261
     * Get the data labels.
262
     *
263
     * @return array Returns the data labels.
264
     */
265
    public function getDataLabels() {
266
        return $this->dataLabels;
267
    }
268
269
    /**
270
     * Get the description.
271
     *
272
     * @return string Returns the description.
273
     */
274
    public function getDescription() {
275
        return $this->description;
276
    }
277
278
    /**
279
     * Get the drilldown.
280
     *
281
     * @return string Returns the drilldown.
282
     */
283
    public function getDrilldown() {
284
        return $this->drilldown;
285
    }
286
287
    /**
288
     * Get the events.
289
     *
290
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\Data\HighchartsEvents Returns the events.
291
     */
292
    public function getEvents() {
293
        return $this->events;
294
    }
295
296
    /**
297
     * Get the high.
298
     *
299
     * @return integer Returns the high.
300
     */
301
    public function getHigh() {
302
        return $this->high;
303
    }
304
305
    /**
306
     * Get the id.
307
     *
308
     * @return string Returns the id.
309
     */
310
    public function getId() {
311
        return $this->id;
312
    }
313
314
    /**
315
     * Get the labelrank.
316
     *
317
     * @return integer Returns the labelrank.
318
     */
319
    public function getLabelrank() {
320
        return $this->labelrank;
321
    }
322
323
    /**
324
     * Get the low.
325
     *
326
     * @return integer Returns the low.
327
     */
328
    public function getLow() {
329
        return $this->low;
330
    }
331
332
    /**
333
     * Get the median.
334
     *
335
     * @return integer Returns the median.
336
     */
337
    public function getMedian() {
338
        return $this->median;
339
    }
340
341
    /**
342
     * Get the name.
343
     *
344
     * @return string Returns the name.
345
     */
346
    public function getName() {
347
        return $this->name;
348
    }
349
350
    /**
351
     * Get the q1.
352
     *
353
     * @return integer Returns the q1.
354
     */
355
    public function getQ1() {
356
        return $this->q1;
357
    }
358
359
    /**
360
     * Get the q3.
361
     *
362
     * @return integer Returns the q3.
363
     */
364
    public function getQ3() {
365
        return $this->q3;
366
    }
367
368
    /**
369
     * Get the selected.
370
     *
371
     * @return boolean Returns the selected.
372
     */
373
    public function getSelected() {
374
        return $this->selected;
375
    }
376
377
    /**
378
     * Get the x.
379
     *
380
     * @return integer Returns the x.
381
     */
382
    public function getX() {
383
        return $this->x;
384
    }
385
386
    /**
387
     * Get the y.
388
     *
389
     * @return integer Returns the y.
390
     */
391
    public function getY() {
392
        return $this->y;
393
    }
394
395
    /**
396
     * Serialize this instance.
397
     *
398
     * @return array Returns an array representing this instance.
399
     */
400
    public function jsonSerialize() {
401
        return $this->toArray();
402
    }
403
404
    /**
405
     * Create a new events.
406
     *
407
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\Data\HighchartsEvents Returns the events.
408
     */
409
    public function newEvents() {
410
        $this->events = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\Data\HighchartsEvents();
411
        return $this->events;
412
    }
413
414
    /**
415
     * Set the class name.
416
     *
417
     * @param string $className The class name.
418
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
419
     */
420
    public function setClassName($className) {
421
        $this->className = $className;
422
        return $this;
423
    }
424
425
    /**
426
     * Set the color.
427
     *
428
     * @param string $color The color.
429
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
430
     */
431
    public function setColor($color) {
432
        $this->color = $color;
433
        return $this;
434
    }
435
436
    /**
437
     * Set the color index.
438
     *
439
     * @param integer $colorIndex The color index.
440
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
441
     */
442
    public function setColorIndex($colorIndex) {
443
        $this->colorIndex = $colorIndex;
444
        return $this;
445
    }
446
447
    /**
448
     * Set the data labels.
449
     *
450
     * @param array $dataLabels The data labels.
451
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
452
     */
453
    public function setDataLabels(array $dataLabels = null) {
454
        $this->dataLabels = $dataLabels;
0 ignored issues
show
Documentation Bug introduced by
It seems like $dataLabels can be null. However, the property $dataLabels is declared as array. Maybe change the type of the property to array|null or add a type check?

Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.

To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.

function aContainsB(array $needle = null, array  $haystack) {
    if (!$needle) {
        return false;
    }

    return array_intersect($haystack, $needle) == $haystack;
}

The function can be called with either null or an array for the parameter $needle but will only accept an array as $haystack.

Loading history...
455
        return $this;
456
    }
457
458
    /**
459
     * Set the description.
460
     *
461
     * @param string $description The description.
462
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
463
     */
464
    public function setDescription($description) {
465
        $this->description = $description;
466
        return $this;
467
    }
468
469
    /**
470
     * Set the drilldown.
471
     *
472
     * @param string $drilldown The drilldown.
473
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
474
     */
475
    public function setDrilldown($drilldown) {
476
        $this->drilldown = $drilldown;
477
        return $this;
478
    }
479
480
    /**
481
     * Set the events.
482
     *
483
     * @param \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\Data\HighchartsEvents $events The events.
484
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
485
     */
486
    public function setEvents(\WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\Data\HighchartsEvents $events = null) {
487
        $this->events = $events;
488
        return $this;
489
    }
490
491
    /**
492
     * Set the high.
493
     *
494
     * @param integer $high The high.
495
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
496
     */
497
    public function setHigh($high) {
498
        $this->high = $high;
499
        return $this;
500
    }
501
502
    /**
503
     * Set the id.
504
     *
505
     * @param string $id The id.
506
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
507
     */
508
    public function setId($id) {
509
        $this->id = $id;
510
        return $this;
511
    }
512
513
    /**
514
     * Set the labelrank.
515
     *
516
     * @param integer $labelrank The labelrank.
517
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
518
     */
519
    public function setLabelrank($labelrank) {
520
        $this->labelrank = $labelrank;
521
        return $this;
522
    }
523
524
    /**
525
     * Set the low.
526
     *
527
     * @param integer $low The low.
528
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
529
     */
530
    public function setLow($low) {
531
        $this->low = $low;
532
        return $this;
533
    }
534
535
    /**
536
     * Set the median.
537
     *
538
     * @param integer $median The median.
539
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
540
     */
541
    public function setMedian($median) {
542
        $this->median = $median;
543
        return $this;
544
    }
545
546
    /**
547
     * Set the name.
548
     *
549
     * @param string $name The name.
550
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
551
     */
552
    public function setName($name) {
553
        $this->name = $name;
554
        return $this;
555
    }
556
557
    /**
558
     * Set the q1.
559
     *
560
     * @param integer $q1 The q1.
561
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
562
     */
563
    public function setQ1($q1) {
564
        $this->q1 = $q1;
565
        return $this;
566
    }
567
568
    /**
569
     * Set the q3.
570
     *
571
     * @param integer $q3 The q3.
572
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
573
     */
574
    public function setQ3($q3) {
575
        $this->q3 = $q3;
576
        return $this;
577
    }
578
579
    /**
580
     * Set the selected.
581
     *
582
     * @param boolean $selected The selected.
583
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
584
     */
585
    public function setSelected($selected) {
586
        $this->selected = $selected;
587
        return $this;
588
    }
589
590
    /**
591
     * Set the x.
592
     *
593
     * @param integer $x The x.
594
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
595
     */
596
    public function setX($x) {
597
        $this->x = $x;
598
        return $this;
599
    }
600
601
    /**
602
     * Set the y.
603
     *
604
     * @param integer $y The y.
605
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Series\Boxplot\HighchartsData Returns the highcharts data.
606
     */
607
    public function setY($y) {
608
        $this->y = $y;
609
        return $this;
610
    }
611
612
    /**
613
     * Convert into an array representing this instance.
614
     *
615
     * @return array Returns an array representing this instance.
616
     */
617
    public function toArray() {
618
619
        // Initialize the output.
620
        $output = [];
621
622
        // Set the class name.
623
        ArrayUtility::set($output, "className", $this->className, [null]);
624
625
        // Set the color.
626
        ArrayUtility::set($output, "color", $this->color, [null]);
627
628
        // Set the color index.
629
        ArrayUtility::set($output, "colorIndex", $this->colorIndex, [null]);
630
631
        // Set the data labels.
632
        ArrayUtility::set($output, "dataLabels", $this->dataLabels, [null]);
633
634
        // Set the description.
635
        ArrayUtility::set($output, "description", $this->description, [null]);
636
637
        // Set the drilldown.
638
        ArrayUtility::set($output, "drilldown", $this->drilldown, [null]);
639
640
        // Set the events.
641
        if (null !== $this->events) {
642
            ArrayUtility::set($output, "events", $this->events->toArray(), []);
643
        }
644
645
        // Set the high.
646
        ArrayUtility::set($output, "high", $this->high, [null]);
647
648
        // Set the id.
649
        ArrayUtility::set($output, "id", $this->id, [null]);
650
651
        // Set the labelrank.
652
        ArrayUtility::set($output, "labelrank", $this->labelrank, [null]);
653
654
        // Set the low.
655
        ArrayUtility::set($output, "low", $this->low, [null]);
656
657
        // Set the median.
658
        ArrayUtility::set($output, "median", $this->median, [null]);
659
660
        // Set the name.
661
        ArrayUtility::set($output, "name", $this->name, [null]);
662
663
        // Set the q1.
664
        ArrayUtility::set($output, "q1", $this->q1, [null]);
665
666
        // Set the q3.
667
        ArrayUtility::set($output, "q3", $this->q3, [null]);
668
669
        // Set the selected.
670
        ArrayUtility::set($output, "selected", $this->selected, [null]);
671
672
        // Set the x.
673
        ArrayUtility::set($output, "x", $this->x, [null]);
674
675
        // Set the y.
676
        ArrayUtility::set($output, "y", $this->y, [null]);
677
678
        // Return the output.
679
        return $output;
680
    }
681
682
}
683