HighchartsLegend   F
last analyzed

Complexity

Total Complexity 93

Size/Duplication

Total Lines 1335
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 93
lcom 1
cbo 3
dl 0
loc 1335
rs 0.8
c 0
b 0
f 0

80 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
B clear() 0 117 3
A getAlign() 0 3 1
A getBackgroundColor() 0 3 1
A getBorderColor() 0 3 1
A getBorderRadius() 0 3 1
A getBorderWidth() 0 3 1
A getEnabled() 0 3 1
A getFloating() 0 3 1
A getItemDistance() 0 3 1
A getItemHiddenStyle() 0 3 1
A getItemHoverStyle() 0 3 1
A getItemMarginBottom() 0 3 1
A getItemMarginTop() 0 3 1
A getItemStyle() 0 3 1
A getItemWidth() 0 3 1
A getLabelFormat() 0 3 1
A getLabelFormatter() 0 3 1
A getLayout() 0 3 1
A getLineHeight() 0 3 1
A getMargin() 0 3 1
A getMaxHeight() 0 3 1
A getNavigation() 0 3 1
A getPadding() 0 3 1
A getReversed() 0 3 1
A getRtl() 0 3 1
A getShadow() 0 3 1
A getSquareSymbol() 0 3 1
A getStyle() 0 3 1
A getSymbolHeight() 0 3 1
A getSymbolPadding() 0 3 1
A getSymbolRadius() 0 3 1
A getSymbolWidth() 0 3 1
A getTitle() 0 3 1
A getUseHTML() 0 3 1
A getVerticalAlign() 0 3 1
A getWidth() 0 3 1
A getX() 0 3 1
A getY() 0 3 1
A jsonSerialize() 0 3 1
A newNavigation() 0 4 1
A newTitle() 0 4 1
A setAlign() 0 10 4
A setBackgroundColor() 0 4 1
A setBorderColor() 0 4 1
A setBorderRadius() 0 4 1
A setBorderWidth() 0 4 1
A setEnabled() 0 4 1
A setFloating() 0 4 1
A setItemDistance() 0 4 1
A setItemHiddenStyle() 0 4 1
A setItemHoverStyle() 0 4 1
A setItemMarginBottom() 0 4 1
A setItemMarginTop() 0 4 1
A setItemStyle() 0 4 1
A setItemWidth() 0 4 1
A setLabelFormat() 0 4 1
A setLabelFormatter() 0 4 1
A setLayout() 0 9 3
A setLineHeight() 0 4 1
A setMargin() 0 4 1
A setMaxHeight() 0 4 1
A setNavigation() 0 4 1
A setPadding() 0 4 1
A setReversed() 0 4 1
A setRtl() 0 4 1
A setShadow() 0 4 1
A setSquareSymbol() 0 4 1
A setStyle() 0 4 1
A setSymbolHeight() 0 4 1
A setSymbolPadding() 0 4 1
A setSymbolRadius() 0 4 1
A setSymbolWidth() 0 4 1
A setTitle() 0 4 1
A setUseHTML() 0 4 1
A setVerticalAlign() 0 10 4
A setWidth() 0 4 1
A setX() 0 4 1
A setY() 0 4 1
B toArray() 0 123 3

How to fix   Complexity   

Complex Class

Complex classes like HighchartsLegend often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use HighchartsLegend, and based on these observations, apply Extract Interface, too.

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 legend.
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 HighchartsLegend implements JsonSerializable {
26
27
    /**
28
     * Align.
29
     *
30
     * @var string
31
     * @since 2.0
32
     */
33
    private $align = "center";
34
35
    /**
36
     * Background color.
37
     *
38
     * @var string
39
     */
40
    private $backgroundColor;
41
42
    /**
43
     * Border color.
44
     *
45
     * @var string
46
     */
47
    private $borderColor = "#999999";
48
49
    /**
50
     * Border radius.
51
     *
52
     * @var integer
53
     */
54
    private $borderRadius = 0;
55
56
    /**
57
     * Border width.
58
     *
59
     * @var integer
60
     */
61
    private $borderWidth = 0;
62
63
    /**
64
     * Enabled.
65
     *
66
     * @var boolean
67
     */
68
    private $enabled = true;
69
70
    /**
71
     * Floating.
72
     *
73
     * @var boolean
74
     * @since 2.1
75
     */
76
    private $floating = false;
77
78
    /**
79
     * Item distance.
80
     *
81
     * @var integer
82
     * @since 3.0.3
83
     */
84
    private $itemDistance = 20;
85
86
    /**
87
     * Item hidden style.
88
     *
89
     * @var array
90
     */
91
    private $itemHiddenStyle = ["color" => "#cccccc"];
92
93
    /**
94
     * Item hover style.
95
     *
96
     * @var array
97
     */
98
    private $itemHoverStyle = ["color" => "#000000"];
99
100
    /**
101
     * Item margin bottom.
102
     *
103
     * @var integer
104
     * @since 2.2.0
105
     */
106
    private $itemMarginBottom = 0;
107
108
    /**
109
     * Item margin top.
110
     *
111
     * @var integer
112
     * @since 2.2.0
113
     */
114
    private $itemMarginTop = 0;
115
116
    /**
117
     * Item style.
118
     *
119
     * @var array
120
     */
121
    private $itemStyle = ["color" => "#333333", "cursor" => "pointer", "fontSize" => "12px", "fontWeight" => "bold", "textOverflow" => "ellipsis"];
122
123
    /**
124
     * Item width.
125
     *
126
     * @var integer
127
     * @since 2.0
128
     */
129
    private $itemWidth;
130
131
    /**
132
     * Label format.
133
     *
134
     * @var string
135
     * @since 1.3
136
     */
137
    private $labelFormat = "{name}";
138
139
    /**
140
     * Label formatter.
141
     *
142
     * @var string
143
     */
144
    private $labelFormatter;
145
146
    /**
147
     * Layout.
148
     *
149
     * @var string
150
     */
151
    private $layout = "horizontal";
152
153
    /**
154
     * Line height.
155
     *
156
     * @var integer
157
     * @since 2.0
158
     */
159
    private $lineHeight = 16;
160
161
    /**
162
     * Margin.
163
     *
164
     * @var integer
165
     * @since 2.1
166
     */
167
    private $margin = 12;
168
169
    /**
170
     * Max height.
171
     *
172
     * @var integer
173
     * @since 2.3.0
174
     */
175
    private $maxHeight;
176
177
    /**
178
     * Navigation.
179
     *
180
     * @var \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsNavigation
181
     */
182
    private $navigation;
183
184
    /**
185
     * Padding.
186
     *
187
     * @var integer
188
     * @since 2.2.0
189
     */
190
    private $padding = 8;
191
192
    /**
193
     * Reversed.
194
     *
195
     * @var boolean
196
     * @since 1.2.5
197
     */
198
    private $reversed = false;
199
200
    /**
201
     * Rtl.
202
     *
203
     * @var boolean
204
     * @since 2.2
205
     */
206
    private $rtl = false;
207
208
    /**
209
     * Shadow.
210
     *
211
     * @var boolean|array
212
     */
213
    private $shadow = false;
214
215
    /**
216
     * Square symbol.
217
     *
218
     * @var boolean
219
     * @since 5.0.0
220
     */
221
    private $squareSymbol = true;
222
223
    /**
224
     * Style.
225
     *
226
     * @var array
227
     * @deprecated
228
     */
229
    private $style;
230
231
    /**
232
     * Symbol height.
233
     *
234
     * @var integer
235
     * @since 3.0.8
236
     */
237
    private $symbolHeight;
238
239
    /**
240
     * Symbol padding.
241
     *
242
     * @var integer
243
     */
244
    private $symbolPadding = 5;
245
246
    /**
247
     * Symbol radius.
248
     *
249
     * @var integer
250
     * @since 3.0.8
251
     */
252
    private $symbolRadius;
253
254
    /**
255
     * Symbol width.
256
     *
257
     * @var integer
258
     */
259
    private $symbolWidth;
260
261
    /**
262
     * Title.
263
     *
264
     * @var \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsTitle
265
     * @since 3.0
266
     */
267
    private $title;
268
269
    /**
270
     * Use HTML.
271
     *
272
     * @var boolean
273
     */
274
    private $useHTML = false;
275
276
    /**
277
     * Vertical align.
278
     *
279
     * @var string
280
     * @since 2.0
281
     */
282
    private $verticalAlign = "bottom";
283
284
    /**
285
     * Width.
286
     *
287
     * @var integer
288
     * @since 2.0
289
     */
290
    private $width;
291
292
    /**
293
     * X.
294
     *
295
     * @var integer
296
     * @since 2.0
297
     */
298
    private $x = 0;
299
300
    /**
301
     * Y.
302
     *
303
     * @var integer
304
     * @since 2.0
305
     */
306
    private $y = 0;
307
308
    /**
309
     * Constructor.
310
     *
311
     * @param boolean $ignoreDefaultValues Ignore the default values.
312
     */
313
    public function __construct($ignoreDefaultValues = true) {
314
        if (true === $ignoreDefaultValues) {
315
            $this->clear();
316
        }
317
    }
318
319
    /**
320
     * Clear.
321
     *
322
     * @return void
323
     */
324
    public function clear() {
325
326
        // Clear the align.
327
        $this->align = null;
328
329
        // Clear the background color.
330
        $this->backgroundColor = null;
331
332
        // Clear the border color.
333
        $this->borderColor = null;
334
335
        // Clear the border radius.
336
        $this->borderRadius = null;
337
338
        // Clear the border width.
339
        $this->borderWidth = null;
340
341
        // Clear the enabled.
342
        $this->enabled = null;
343
344
        // Clear the floating.
345
        $this->floating = null;
346
347
        // Clear the item distance.
348
        $this->itemDistance = null;
349
350
        // Clear the item hidden style.
351
        $this->itemHiddenStyle = 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 $itemHiddenStyle.

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...
352
353
        // Clear the item hover style.
354
        $this->itemHoverStyle = 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 $itemHoverStyle.

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...
355
356
        // Clear the item margin bottom.
357
        $this->itemMarginBottom = null;
358
359
        // Clear the item margin top.
360
        $this->itemMarginTop = null;
361
362
        // Clear the item style.
363
        $this->itemStyle = 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 $itemStyle.

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...
364
365
        // Clear the item width.
366
        $this->itemWidth = null;
367
368
        // Clear the label format.
369
        $this->labelFormat = null;
370
371
        // Clear the label formatter.
372
        $this->labelFormatter = null;
373
374
        // Clear the layout.
375
        $this->layout = null;
376
377
        // Clear the line height.
378
        $this->lineHeight = null;
379
380
        // Clear the margin.
381
        $this->margin = null;
382
383
        // Clear the max height.
384
        $this->maxHeight = null;
385
386
        // Clear the navigation.
387
        if (null !== $this->navigation) {
388
            $this->navigation->clear();
389
        }
390
391
        // Clear the padding.
392
        $this->padding = null;
393
394
        // Clear the reversed.
395
        $this->reversed = null;
396
397
        // Clear the rtl.
398
        $this->rtl = null;
399
400
        // Clear the shadow.
401
        $this->shadow = null;
402
403
        // Clear the square symbol.
404
        $this->squareSymbol = null;
405
406
        // Clear the style.
407
        $this->style = 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 $style.

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...
Deprecated Code introduced by
The property WBW\Bundle\HighchartsBun...ighchartsLegend::$style has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
408
409
        // Clear the symbol height.
410
        $this->symbolHeight = null;
411
412
        // Clear the symbol padding.
413
        $this->symbolPadding = null;
414
415
        // Clear the symbol radius.
416
        $this->symbolRadius = null;
417
418
        // Clear the symbol width.
419
        $this->symbolWidth = null;
420
421
        // Clear the title.
422
        if (null !== $this->title) {
423
            $this->title->clear();
424
        }
425
426
        // Clear the use HTML.
427
        $this->useHTML = null;
428
429
        // Clear the vertical align.
430
        $this->verticalAlign = null;
431
432
        // Clear the width.
433
        $this->width = null;
434
435
        // Clear the x.
436
        $this->x = null;
437
438
        // Clear the y.
439
        $this->y = null;
440
    }
441
442
    /**
443
     * Get the align.
444
     *
445
     * @return string Returns the align.
446
     */
447
    public function getAlign() {
448
        return $this->align;
449
    }
450
451
    /**
452
     * Get the background color.
453
     *
454
     * @return string Returns the background color.
455
     */
456
    public function getBackgroundColor() {
457
        return $this->backgroundColor;
458
    }
459
460
    /**
461
     * Get the border color.
462
     *
463
     * @return string Returns the border color.
464
     */
465
    public function getBorderColor() {
466
        return $this->borderColor;
467
    }
468
469
    /**
470
     * Get the border radius.
471
     *
472
     * @return integer Returns the border radius.
473
     */
474
    public function getBorderRadius() {
475
        return $this->borderRadius;
476
    }
477
478
    /**
479
     * Get the border width.
480
     *
481
     * @return integer Returns the border width.
482
     */
483
    public function getBorderWidth() {
484
        return $this->borderWidth;
485
    }
486
487
    /**
488
     * Get the enabled.
489
     *
490
     * @return boolean Returns the enabled.
491
     */
492
    public function getEnabled() {
493
        return $this->enabled;
494
    }
495
496
    /**
497
     * Get the floating.
498
     *
499
     * @return boolean Returns the floating.
500
     */
501
    public function getFloating() {
502
        return $this->floating;
503
    }
504
505
    /**
506
     * Get the item distance.
507
     *
508
     * @return integer Returns the item distance.
509
     */
510
    public function getItemDistance() {
511
        return $this->itemDistance;
512
    }
513
514
    /**
515
     * Get the item hidden style.
516
     *
517
     * @return array Returns the item hidden style.
518
     */
519
    public function getItemHiddenStyle() {
520
        return $this->itemHiddenStyle;
521
    }
522
523
    /**
524
     * Get the item hover style.
525
     *
526
     * @return array Returns the item hover style.
527
     */
528
    public function getItemHoverStyle() {
529
        return $this->itemHoverStyle;
530
    }
531
532
    /**
533
     * Get the item margin bottom.
534
     *
535
     * @return integer Returns the item margin bottom.
536
     */
537
    public function getItemMarginBottom() {
538
        return $this->itemMarginBottom;
539
    }
540
541
    /**
542
     * Get the item margin top.
543
     *
544
     * @return integer Returns the item margin top.
545
     */
546
    public function getItemMarginTop() {
547
        return $this->itemMarginTop;
548
    }
549
550
    /**
551
     * Get the item style.
552
     *
553
     * @return array Returns the item style.
554
     */
555
    public function getItemStyle() {
556
        return $this->itemStyle;
557
    }
558
559
    /**
560
     * Get the item width.
561
     *
562
     * @return integer Returns the item width.
563
     */
564
    public function getItemWidth() {
565
        return $this->itemWidth;
566
    }
567
568
    /**
569
     * Get the label format.
570
     *
571
     * @return string Returns the label format.
572
     */
573
    public function getLabelFormat() {
574
        return $this->labelFormat;
575
    }
576
577
    /**
578
     * Get the label formatter.
579
     *
580
     * @return string Returns the label formatter.
581
     */
582
    public function getLabelFormatter() {
583
        return $this->labelFormatter;
584
    }
585
586
    /**
587
     * Get the layout.
588
     *
589
     * @return string Returns the layout.
590
     */
591
    public function getLayout() {
592
        return $this->layout;
593
    }
594
595
    /**
596
     * Get the line height.
597
     *
598
     * @return integer Returns the line height.
599
     */
600
    public function getLineHeight() {
601
        return $this->lineHeight;
602
    }
603
604
    /**
605
     * Get the margin.
606
     *
607
     * @return integer Returns the margin.
608
     */
609
    public function getMargin() {
610
        return $this->margin;
611
    }
612
613
    /**
614
     * Get the max height.
615
     *
616
     * @return integer Returns the max height.
617
     */
618
    public function getMaxHeight() {
619
        return $this->maxHeight;
620
    }
621
622
    /**
623
     * Get the navigation.
624
     *
625
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsNavigation Returns the navigation.
626
     */
627
    public function getNavigation() {
628
        return $this->navigation;
629
    }
630
631
    /**
632
     * Get the padding.
633
     *
634
     * @return integer Returns the padding.
635
     */
636
    public function getPadding() {
637
        return $this->padding;
638
    }
639
640
    /**
641
     * Get the reversed.
642
     *
643
     * @return boolean Returns the reversed.
644
     */
645
    public function getReversed() {
646
        return $this->reversed;
647
    }
648
649
    /**
650
     * Get the rtl.
651
     *
652
     * @return boolean Returns the rtl.
653
     */
654
    public function getRtl() {
655
        return $this->rtl;
656
    }
657
658
    /**
659
     * Get the shadow.
660
     *
661
     * @return boolean|array Returns the shadow.
662
     */
663
    public function getShadow() {
664
        return $this->shadow;
665
    }
666
667
    /**
668
     * Get the square symbol.
669
     *
670
     * @return boolean Returns the square symbol.
671
     */
672
    public function getSquareSymbol() {
673
        return $this->squareSymbol;
674
    }
675
676
    /**
677
     * Get the style.
678
     *
679
     * @return array Returns the style.
680
     * @deprecated
681
     */
682
    public function getStyle() {
683
        return $this->style;
0 ignored issues
show
Deprecated Code introduced by
The property WBW\Bundle\HighchartsBun...ighchartsLegend::$style has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
684
    }
685
686
    /**
687
     * Get the symbol height.
688
     *
689
     * @return integer Returns the symbol height.
690
     */
691
    public function getSymbolHeight() {
692
        return $this->symbolHeight;
693
    }
694
695
    /**
696
     * Get the symbol padding.
697
     *
698
     * @return integer Returns the symbol padding.
699
     */
700
    public function getSymbolPadding() {
701
        return $this->symbolPadding;
702
    }
703
704
    /**
705
     * Get the symbol radius.
706
     *
707
     * @return integer Returns the symbol radius.
708
     */
709
    public function getSymbolRadius() {
710
        return $this->symbolRadius;
711
    }
712
713
    /**
714
     * Get the symbol width.
715
     *
716
     * @return integer Returns the symbol width.
717
     */
718
    public function getSymbolWidth() {
719
        return $this->symbolWidth;
720
    }
721
722
    /**
723
     * Get the title.
724
     *
725
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsTitle Returns the title.
726
     */
727
    public function getTitle() {
728
        return $this->title;
729
    }
730
731
    /**
732
     * Get the use HTML.
733
     *
734
     * @return boolean Returns the use HTML.
735
     */
736
    public function getUseHTML() {
737
        return $this->useHTML;
738
    }
739
740
    /**
741
     * Get the vertical align.
742
     *
743
     * @return string Returns the vertical align.
744
     */
745
    public function getVerticalAlign() {
746
        return $this->verticalAlign;
747
    }
748
749
    /**
750
     * Get the width.
751
     *
752
     * @return integer Returns the width.
753
     */
754
    public function getWidth() {
755
        return $this->width;
756
    }
757
758
    /**
759
     * Get the x.
760
     *
761
     * @return integer Returns the x.
762
     */
763
    public function getX() {
764
        return $this->x;
765
    }
766
767
    /**
768
     * Get the y.
769
     *
770
     * @return integer Returns the y.
771
     */
772
    public function getY() {
773
        return $this->y;
774
    }
775
776
    /**
777
     * Serialize this instance.
778
     *
779
     * @return array Returns an array representing this instance.
780
     */
781
    public function jsonSerialize() {
782
        return $this->toArray();
783
    }
784
785
    /**
786
     * Create a new navigation.
787
     *
788
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsNavigation Returns the navigation.
789
     */
790
    public function newNavigation() {
791
        $this->navigation = new \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsNavigation();
792
        return $this->navigation;
793
    }
794
795
    /**
796
     * Create a new title.
797
     *
798
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsTitle Returns the title.
799
     */
800
    public function newTitle() {
801
        $this->title = new \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsTitle();
802
        return $this->title;
803
    }
804
805
    /**
806
     * Set the align.
807
     *
808
     * @param string $align The align.
809
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
810
     */
811
    public function setAlign($align) {
812
        switch ($align) {
813
            case "center":
814
            case "left":
815
            case "right":
816
            $this->align = $align;
817
            break;
818
        }
819
        return $this;
820
    }
821
822
    /**
823
     * Set the background color.
824
     *
825
     * @param string $backgroundColor The background color.
826
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
827
     */
828
    public function setBackgroundColor($backgroundColor) {
829
        $this->backgroundColor = $backgroundColor;
830
        return $this;
831
    }
832
833
    /**
834
     * Set the border color.
835
     *
836
     * @param string $borderColor The border color.
837
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
838
     */
839
    public function setBorderColor($borderColor) {
840
        $this->borderColor = $borderColor;
841
        return $this;
842
    }
843
844
    /**
845
     * Set the border radius.
846
     *
847
     * @param integer $borderRadius The border radius.
848
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
849
     */
850
    public function setBorderRadius($borderRadius) {
851
        $this->borderRadius = $borderRadius;
852
        return $this;
853
    }
854
855
    /**
856
     * Set the border width.
857
     *
858
     * @param integer $borderWidth The border width.
859
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
860
     */
861
    public function setBorderWidth($borderWidth) {
862
        $this->borderWidth = $borderWidth;
863
        return $this;
864
    }
865
866
    /**
867
     * Set the enabled.
868
     *
869
     * @param boolean $enabled The enabled.
870
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
871
     */
872
    public function setEnabled($enabled) {
873
        $this->enabled = $enabled;
874
        return $this;
875
    }
876
877
    /**
878
     * Set the floating.
879
     *
880
     * @param boolean $floating The floating.
881
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
882
     */
883
    public function setFloating($floating) {
884
        $this->floating = $floating;
885
        return $this;
886
    }
887
888
    /**
889
     * Set the item distance.
890
     *
891
     * @param integer $itemDistance The item distance.
892
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
893
     */
894
    public function setItemDistance($itemDistance) {
895
        $this->itemDistance = $itemDistance;
896
        return $this;
897
    }
898
899
    /**
900
     * Set the item hidden style.
901
     *
902
     * @param array $itemHiddenStyle The item hidden style.
903
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
904
     */
905
    public function setItemHiddenStyle(array $itemHiddenStyle = null) {
906
        $this->itemHiddenStyle = $itemHiddenStyle;
0 ignored issues
show
Documentation Bug introduced by
It seems like $itemHiddenStyle can be null. However, the property $itemHiddenStyle 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...
907
        return $this;
908
    }
909
910
    /**
911
     * Set the item hover style.
912
     *
913
     * @param array $itemHoverStyle The item hover style.
914
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
915
     */
916
    public function setItemHoverStyle(array $itemHoverStyle = null) {
917
        $this->itemHoverStyle = $itemHoverStyle;
0 ignored issues
show
Documentation Bug introduced by
It seems like $itemHoverStyle can be null. However, the property $itemHoverStyle 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...
918
        return $this;
919
    }
920
921
    /**
922
     * Set the item margin bottom.
923
     *
924
     * @param integer $itemMarginBottom The item margin bottom.
925
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
926
     */
927
    public function setItemMarginBottom($itemMarginBottom) {
928
        $this->itemMarginBottom = $itemMarginBottom;
929
        return $this;
930
    }
931
932
    /**
933
     * Set the item margin top.
934
     *
935
     * @param integer $itemMarginTop The item margin top.
936
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
937
     */
938
    public function setItemMarginTop($itemMarginTop) {
939
        $this->itemMarginTop = $itemMarginTop;
940
        return $this;
941
    }
942
943
    /**
944
     * Set the item style.
945
     *
946
     * @param array $itemStyle The item style.
947
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
948
     */
949
    public function setItemStyle(array $itemStyle = null) {
950
        $this->itemStyle = $itemStyle;
0 ignored issues
show
Documentation Bug introduced by
It seems like $itemStyle can be null. However, the property $itemStyle 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...
951
        return $this;
952
    }
953
954
    /**
955
     * Set the item width.
956
     *
957
     * @param integer $itemWidth The item width.
958
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
959
     */
960
    public function setItemWidth($itemWidth) {
961
        $this->itemWidth = $itemWidth;
962
        return $this;
963
    }
964
965
    /**
966
     * Set the label format.
967
     *
968
     * @param string $labelFormat The label format.
969
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
970
     */
971
    public function setLabelFormat($labelFormat) {
972
        $this->labelFormat = $labelFormat;
973
        return $this;
974
    }
975
976
    /**
977
     * Set the label formatter.
978
     *
979
     * @param string $labelFormatter The label formatter.
980
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
981
     */
982
    public function setLabelFormatter($labelFormatter) {
983
        $this->labelFormatter = $labelFormatter;
984
        return $this;
985
    }
986
987
    /**
988
     * Set the layout.
989
     *
990
     * @param string $layout The layout.
991
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
992
     */
993
    public function setLayout($layout) {
994
        switch ($layout) {
995
            case "horizontal":
996
            case "vertical":
997
            $this->layout = $layout;
998
            break;
999
        }
1000
        return $this;
1001
    }
1002
1003
    /**
1004
     * Set the line height.
1005
     *
1006
     * @param integer $lineHeight The line height.
1007
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1008
     */
1009
    public function setLineHeight($lineHeight) {
1010
        $this->lineHeight = $lineHeight;
1011
        return $this;
1012
    }
1013
1014
    /**
1015
     * Set the margin.
1016
     *
1017
     * @param integer $margin The margin.
1018
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1019
     */
1020
    public function setMargin($margin) {
1021
        $this->margin = $margin;
1022
        return $this;
1023
    }
1024
1025
    /**
1026
     * Set the max height.
1027
     *
1028
     * @param integer $maxHeight The max height.
1029
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1030
     */
1031
    public function setMaxHeight($maxHeight) {
1032
        $this->maxHeight = $maxHeight;
1033
        return $this;
1034
    }
1035
1036
    /**
1037
     * Set the navigation.
1038
     *
1039
     * @param \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsNavigation $navigation The navigation.
1040
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1041
     */
1042
    public function setNavigation(\WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsNavigation $navigation = null) {
1043
        $this->navigation = $navigation;
1044
        return $this;
1045
    }
1046
1047
    /**
1048
     * Set the padding.
1049
     *
1050
     * @param integer $padding The padding.
1051
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1052
     */
1053
    public function setPadding($padding) {
1054
        $this->padding = $padding;
1055
        return $this;
1056
    }
1057
1058
    /**
1059
     * Set the reversed.
1060
     *
1061
     * @param boolean $reversed The reversed.
1062
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1063
     */
1064
    public function setReversed($reversed) {
1065
        $this->reversed = $reversed;
1066
        return $this;
1067
    }
1068
1069
    /**
1070
     * Set the rtl.
1071
     *
1072
     * @param boolean $rtl The rtl.
1073
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1074
     */
1075
    public function setRtl($rtl) {
1076
        $this->rtl = $rtl;
1077
        return $this;
1078
    }
1079
1080
    /**
1081
     * Set the shadow.
1082
     *
1083
     * @param boolean|array $shadow The shadow.
1084
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1085
     */
1086
    public function setShadow($shadow) {
1087
        $this->shadow = $shadow;
1088
        return $this;
1089
    }
1090
1091
    /**
1092
     * Set the square symbol.
1093
     *
1094
     * @param boolean $squareSymbol The square symbol.
1095
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1096
     */
1097
    public function setSquareSymbol($squareSymbol) {
1098
        $this->squareSymbol = $squareSymbol;
1099
        return $this;
1100
    }
1101
1102
    /**
1103
     * Set the style.
1104
     *
1105
     * @param array $style The style.
1106
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1107
     * @deprecated
1108
     */
1109
    public function setStyle(array $style = null) {
1110
        $this->style = $style;
0 ignored issues
show
Documentation Bug introduced by
It seems like $style can be null. However, the property $style 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...
Deprecated Code introduced by
The property WBW\Bundle\HighchartsBun...ighchartsLegend::$style has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
1111
        return $this;
1112
    }
1113
1114
    /**
1115
     * Set the symbol height.
1116
     *
1117
     * @param integer $symbolHeight The symbol height.
1118
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1119
     */
1120
    public function setSymbolHeight($symbolHeight) {
1121
        $this->symbolHeight = $symbolHeight;
1122
        return $this;
1123
    }
1124
1125
    /**
1126
     * Set the symbol padding.
1127
     *
1128
     * @param integer $symbolPadding The symbol padding.
1129
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1130
     */
1131
    public function setSymbolPadding($symbolPadding) {
1132
        $this->symbolPadding = $symbolPadding;
1133
        return $this;
1134
    }
1135
1136
    /**
1137
     * Set the symbol radius.
1138
     *
1139
     * @param integer $symbolRadius The symbol radius.
1140
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1141
     */
1142
    public function setSymbolRadius($symbolRadius) {
1143
        $this->symbolRadius = $symbolRadius;
1144
        return $this;
1145
    }
1146
1147
    /**
1148
     * Set the symbol width.
1149
     *
1150
     * @param integer $symbolWidth The symbol width.
1151
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1152
     */
1153
    public function setSymbolWidth($symbolWidth) {
1154
        $this->symbolWidth = $symbolWidth;
1155
        return $this;
1156
    }
1157
1158
    /**
1159
     * Set the title.
1160
     *
1161
     * @param \WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsTitle $title The title.
1162
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1163
     */
1164
    public function setTitle(\WBW\Bundle\HighchartsBundle\API\Chart\Legend\HighchartsTitle $title = null) {
1165
        $this->title = $title;
1166
        return $this;
1167
    }
1168
1169
    /**
1170
     * Set the use HTML.
1171
     *
1172
     * @param boolean $useHTML The use HTML.
1173
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1174
     */
1175
    public function setUseHTML($useHTML) {
1176
        $this->useHTML = $useHTML;
1177
        return $this;
1178
    }
1179
1180
    /**
1181
     * Set the vertical align.
1182
     *
1183
     * @param string $verticalAlign The vertical align.
1184
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1185
     */
1186
    public function setVerticalAlign($verticalAlign) {
1187
        switch ($verticalAlign) {
1188
            case "bottom":
1189
            case "middle":
1190
            case "top":
1191
            $this->verticalAlign = $verticalAlign;
1192
            break;
1193
        }
1194
        return $this;
1195
    }
1196
1197
    /**
1198
     * Set the width.
1199
     *
1200
     * @param integer $width The width.
1201
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1202
     */
1203
    public function setWidth($width) {
1204
        $this->width = $width;
1205
        return $this;
1206
    }
1207
1208
    /**
1209
     * Set the x.
1210
     *
1211
     * @param integer $x The x.
1212
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1213
     */
1214
    public function setX($x) {
1215
        $this->x = $x;
1216
        return $this;
1217
    }
1218
1219
    /**
1220
     * Set the y.
1221
     *
1222
     * @param integer $y The y.
1223
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsLegend Returns the highcharts legend.
1224
     */
1225
    public function setY($y) {
1226
        $this->y = $y;
1227
        return $this;
1228
    }
1229
1230
    /**
1231
     * Convert into an array representing this instance.
1232
     *
1233
     * @return array Returns an array representing this instance.
1234
     */
1235
    public function toArray() {
1236
1237
        // Initialize the output.
1238
        $output = [];
1239
1240
        // Set the align.
1241
        ArrayUtility::set($output, "align", $this->align, [null]);
1242
1243
        // Set the background color.
1244
        ArrayUtility::set($output, "backgroundColor", $this->backgroundColor, [null]);
1245
1246
        // Set the border color.
1247
        ArrayUtility::set($output, "borderColor", $this->borderColor, [null]);
1248
1249
        // Set the border radius.
1250
        ArrayUtility::set($output, "borderRadius", $this->borderRadius, [null]);
1251
1252
        // Set the border width.
1253
        ArrayUtility::set($output, "borderWidth", $this->borderWidth, [null]);
1254
1255
        // Set the enabled.
1256
        ArrayUtility::set($output, "enabled", $this->enabled, [null]);
1257
1258
        // Set the floating.
1259
        ArrayUtility::set($output, "floating", $this->floating, [null]);
1260
1261
        // Set the item distance.
1262
        ArrayUtility::set($output, "itemDistance", $this->itemDistance, [null]);
1263
1264
        // Set the item hidden style.
1265
        ArrayUtility::set($output, "itemHiddenStyle", $this->itemHiddenStyle, [null]);
1266
1267
        // Set the item hover style.
1268
        ArrayUtility::set($output, "itemHoverStyle", $this->itemHoverStyle, [null]);
1269
1270
        // Set the item margin bottom.
1271
        ArrayUtility::set($output, "itemMarginBottom", $this->itemMarginBottom, [null]);
1272
1273
        // Set the item margin top.
1274
        ArrayUtility::set($output, "itemMarginTop", $this->itemMarginTop, [null]);
1275
1276
        // Set the item style.
1277
        ArrayUtility::set($output, "itemStyle", $this->itemStyle, [null]);
1278
1279
        // Set the item width.
1280
        ArrayUtility::set($output, "itemWidth", $this->itemWidth, [null]);
1281
1282
        // Set the label format.
1283
        ArrayUtility::set($output, "labelFormat", $this->labelFormat, [null]);
1284
1285
        // Set the label formatter.
1286
        ArrayUtility::set($output, "labelFormatter", $this->labelFormatter, [null]);
1287
1288
        // Set the layout.
1289
        ArrayUtility::set($output, "layout", $this->layout, [null]);
1290
1291
        // Set the line height.
1292
        ArrayUtility::set($output, "lineHeight", $this->lineHeight, [null]);
1293
1294
        // Set the margin.
1295
        ArrayUtility::set($output, "margin", $this->margin, [null]);
1296
1297
        // Set the max height.
1298
        ArrayUtility::set($output, "maxHeight", $this->maxHeight, [null]);
1299
1300
        // Set the navigation.
1301
        if (null !== $this->navigation) {
1302
            ArrayUtility::set($output, "navigation", $this->navigation->toArray(), []);
1303
        }
1304
1305
        // Set the padding.
1306
        ArrayUtility::set($output, "padding", $this->padding, [null]);
1307
1308
        // Set the reversed.
1309
        ArrayUtility::set($output, "reversed", $this->reversed, [null]);
1310
1311
        // Set the rtl.
1312
        ArrayUtility::set($output, "rtl", $this->rtl, [null]);
1313
1314
        // Set the shadow.
1315
        ArrayUtility::set($output, "shadow", $this->shadow, [null]);
1316
1317
        // Set the square symbol.
1318
        ArrayUtility::set($output, "squareSymbol", $this->squareSymbol, [null]);
1319
1320
        // Set the style.
1321
        ArrayUtility::set($output, "style", $this->style, [null]);
0 ignored issues
show
Deprecated Code introduced by
The property WBW\Bundle\HighchartsBun...ighchartsLegend::$style has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
1322
1323
        // Set the symbol height.
1324
        ArrayUtility::set($output, "symbolHeight", $this->symbolHeight, [null]);
1325
1326
        // Set the symbol padding.
1327
        ArrayUtility::set($output, "symbolPadding", $this->symbolPadding, [null]);
1328
1329
        // Set the symbol radius.
1330
        ArrayUtility::set($output, "symbolRadius", $this->symbolRadius, [null]);
1331
1332
        // Set the symbol width.
1333
        ArrayUtility::set($output, "symbolWidth", $this->symbolWidth, [null]);
1334
1335
        // Set the title.
1336
        if (null !== $this->title) {
1337
            ArrayUtility::set($output, "title", $this->title->toArray(), []);
1338
        }
1339
1340
        // Set the use HTML.
1341
        ArrayUtility::set($output, "useHTML", $this->useHTML, [null]);
1342
1343
        // Set the vertical align.
1344
        ArrayUtility::set($output, "verticalAlign", $this->verticalAlign, [null]);
1345
1346
        // Set the width.
1347
        ArrayUtility::set($output, "width", $this->width, [null]);
1348
1349
        // Set the x.
1350
        ArrayUtility::set($output, "x", $this->x, [null]);
1351
1352
        // Set the y.
1353
        ArrayUtility::set($output, "y", $this->y, [null]);
1354
1355
        // Return the output.
1356
        return $output;
1357
    }
1358
1359
}
1360