HighchartsButtonOptions::getSymbolSize()   A
last analyzed

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\Navigation;
13
14
use JsonSerializable;
15
use WBW\Library\Core\Utility\Argument\ArrayUtility;
16
17
/**
18
 * Highcharts button options.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\HighchartsBundle\API\Chart\Navigation
22
 * @version 5.0.14
23
 * @final
24
 */
25
final class HighchartsButtonOptions implements JsonSerializable {
26
27
    /**
28
     * Align.
29
     *
30
     * @var string
31
     * @since 2.0
32
     */
33
    private $align = "right";
34
35
    /**
36
     * Enabled.
37
     *
38
     * @var boolean
39
     * @since 2.0
40
     */
41
    private $enabled = true;
42
43
    /**
44
     * Height.
45
     *
46
     * @var integer
47
     * @since 2.0
48
     */
49
    private $height = 20;
50
51
    /**
52
     * Symbol fill.
53
     *
54
     * @var string
55
     * @since 2.0
56
     */
57
    private $symbolFill = "#666666";
58
59
    /**
60
     * Symbol size.
61
     *
62
     * @var integer
63
     * @since 2.0
64
     */
65
    private $symbolSize = 14;
66
67
    /**
68
     * Symbol stroke.
69
     *
70
     * @var string
71
     * @since 2.0
72
     */
73
    private $symbolStroke = "#666666";
74
75
    /**
76
     * Symbol stroke width.
77
     *
78
     * @var integer
79
     * @since 2.0
80
     */
81
    private $symbolStrokeWidth = 1;
82
83
    /**
84
     * Symbol x.
85
     *
86
     * @var integer
87
     * @since 2.0
88
     */
89
    private $symbolX = 12.5;
90
91
    /**
92
     * Symbol y.
93
     *
94
     * @var integer
95
     * @since 2.0
96
     */
97
    private $symbolY = 10.5;
98
99
    /**
100
     * Text.
101
     *
102
     * @var string
103
     * @since 3.0
104
     */
105
    private $text;
106
107
    /**
108
     * Theme.
109
     *
110
     * @var array
111
     * @since 3.0
112
     */
113
    private $theme;
114
115
    /**
116
     * Vertical align.
117
     *
118
     * @var string
119
     * @since 2.0
120
     */
121
    private $verticalAlign = "top";
122
123
    /**
124
     * Width.
125
     *
126
     * @var integer
127
     * @since 2.0
128
     */
129
    private $width = 24;
130
131
    /**
132
     * Y.
133
     *
134
     * @var integer
135
     * @since 2.0
136
     */
137
    private $y = 0;
138
139
    /**
140
     * Constructor.
141
     *
142
     * @param boolean $ignoreDefaultValues Ignore the default values.
143
     */
144
    public function __construct($ignoreDefaultValues = true) {
145
        if (true === $ignoreDefaultValues) {
146
            $this->clear();
147
        }
148
    }
149
150
    /**
151
     * Clear.
152
     *
153
     * @return void
154
     */
155
    public function clear() {
156
157
        // Clear the align.
158
        $this->align = null;
159
160
        // Clear the enabled.
161
        $this->enabled = null;
162
163
        // Clear the height.
164
        $this->height = null;
165
166
        // Clear the symbol fill.
167
        $this->symbolFill = null;
168
169
        // Clear the symbol size.
170
        $this->symbolSize = null;
171
172
        // Clear the symbol stroke.
173
        $this->symbolStroke = null;
174
175
        // Clear the symbol stroke width.
176
        $this->symbolStrokeWidth = null;
177
178
        // Clear the symbol x.
179
        $this->symbolX = null;
180
181
        // Clear the symbol y.
182
        $this->symbolY = null;
183
184
        // Clear the text.
185
        $this->text = null;
186
187
        // Clear the theme.
188
        $this->theme = 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 $theme.

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...
189
190
        // Clear the vertical align.
191
        $this->verticalAlign = null;
192
193
        // Clear the width.
194
        $this->width = null;
195
196
        // Clear the y.
197
        $this->y = null;
198
    }
199
200
    /**
201
     * Get the align.
202
     *
203
     * @return string Returns the align.
204
     */
205
    public function getAlign() {
206
        return $this->align;
207
    }
208
209
    /**
210
     * Get the enabled.
211
     *
212
     * @return boolean Returns the enabled.
213
     */
214
    public function getEnabled() {
215
        return $this->enabled;
216
    }
217
218
    /**
219
     * Get the height.
220
     *
221
     * @return integer Returns the height.
222
     */
223
    public function getHeight() {
224
        return $this->height;
225
    }
226
227
    /**
228
     * Get the symbol fill.
229
     *
230
     * @return string Returns the symbol fill.
231
     */
232
    public function getSymbolFill() {
233
        return $this->symbolFill;
234
    }
235
236
    /**
237
     * Get the symbol size.
238
     *
239
     * @return integer Returns the symbol size.
240
     */
241
    public function getSymbolSize() {
242
        return $this->symbolSize;
243
    }
244
245
    /**
246
     * Get the symbol stroke.
247
     *
248
     * @return string Returns the symbol stroke.
249
     */
250
    public function getSymbolStroke() {
251
        return $this->symbolStroke;
252
    }
253
254
    /**
255
     * Get the symbol stroke width.
256
     *
257
     * @return integer Returns the symbol stroke width.
258
     */
259
    public function getSymbolStrokeWidth() {
260
        return $this->symbolStrokeWidth;
261
    }
262
263
    /**
264
     * Get the symbol x.
265
     *
266
     * @return integer Returns the symbol x.
267
     */
268
    public function getSymbolX() {
269
        return $this->symbolX;
270
    }
271
272
    /**
273
     * Get the symbol y.
274
     *
275
     * @return integer Returns the symbol y.
276
     */
277
    public function getSymbolY() {
278
        return $this->symbolY;
279
    }
280
281
    /**
282
     * Get the text.
283
     *
284
     * @return string Returns the text.
285
     */
286
    public function getText() {
287
        return $this->text;
288
    }
289
290
    /**
291
     * Get the theme.
292
     *
293
     * @return array Returns the theme.
294
     */
295
    public function getTheme() {
296
        return $this->theme;
297
    }
298
299
    /**
300
     * Get the vertical align.
301
     *
302
     * @return string Returns the vertical align.
303
     */
304
    public function getVerticalAlign() {
305
        return $this->verticalAlign;
306
    }
307
308
    /**
309
     * Get the width.
310
     *
311
     * @return integer Returns the width.
312
     */
313
    public function getWidth() {
314
        return $this->width;
315
    }
316
317
    /**
318
     * Get the y.
319
     *
320
     * @return integer Returns the y.
321
     */
322
    public function getY() {
323
        return $this->y;
324
    }
325
326
    /**
327
     * Serialize this instance.
328
     *
329
     * @return array Returns an array representing this instance.
330
     */
331
    public function jsonSerialize() {
332
        return $this->toArray();
333
    }
334
335
    /**
336
     * Set the align.
337
     *
338
     * @param string $align The align.
339
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
340
     */
341
    public function setAlign($align) {
342
        switch ($align) {
343
            case "center":
344
            case "left":
345
            case "right":
346
            $this->align = $align;
347
            break;
348
        }
349
        return $this;
350
    }
351
352
    /**
353
     * Set the enabled.
354
     *
355
     * @param boolean $enabled The enabled.
356
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
357
     */
358
    public function setEnabled($enabled) {
359
        $this->enabled = $enabled;
360
        return $this;
361
    }
362
363
    /**
364
     * Set the height.
365
     *
366
     * @param integer $height The height.
367
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
368
     */
369
    public function setHeight($height) {
370
        $this->height = $height;
371
        return $this;
372
    }
373
374
    /**
375
     * Set the symbol fill.
376
     *
377
     * @param string $symbolFill The symbol fill.
378
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
379
     */
380
    public function setSymbolFill($symbolFill) {
381
        $this->symbolFill = $symbolFill;
382
        return $this;
383
    }
384
385
    /**
386
     * Set the symbol size.
387
     *
388
     * @param integer $symbolSize The symbol size.
389
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
390
     */
391
    public function setSymbolSize($symbolSize) {
392
        $this->symbolSize = $symbolSize;
393
        return $this;
394
    }
395
396
    /**
397
     * Set the symbol stroke.
398
     *
399
     * @param string $symbolStroke The symbol stroke.
400
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
401
     */
402
    public function setSymbolStroke($symbolStroke) {
403
        $this->symbolStroke = $symbolStroke;
404
        return $this;
405
    }
406
407
    /**
408
     * Set the symbol stroke width.
409
     *
410
     * @param integer $symbolStrokeWidth The symbol stroke width.
411
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
412
     */
413
    public function setSymbolStrokeWidth($symbolStrokeWidth) {
414
        $this->symbolStrokeWidth = $symbolStrokeWidth;
415
        return $this;
416
    }
417
418
    /**
419
     * Set the symbol x.
420
     *
421
     * @param integer $symbolX The symbol x.
422
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
423
     */
424
    public function setSymbolX($symbolX) {
425
        $this->symbolX = $symbolX;
426
        return $this;
427
    }
428
429
    /**
430
     * Set the symbol y.
431
     *
432
     * @param integer $symbolY The symbol y.
433
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
434
     */
435
    public function setSymbolY($symbolY) {
436
        $this->symbolY = $symbolY;
437
        return $this;
438
    }
439
440
    /**
441
     * Set the text.
442
     *
443
     * @param string $text The text.
444
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
445
     */
446
    public function setText($text) {
447
        $this->text = $text;
448
        return $this;
449
    }
450
451
    /**
452
     * Set the theme.
453
     *
454
     * @param array $theme The theme.
455
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
456
     */
457
    public function setTheme(array $theme = null) {
458
        $this->theme = $theme;
0 ignored issues
show
Documentation Bug introduced by
It seems like $theme can be null. However, the property $theme 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...
459
        return $this;
460
    }
461
462
    /**
463
     * Set the vertical align.
464
     *
465
     * @param string $verticalAlign The vertical align.
466
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
467
     */
468
    public function setVerticalAlign($verticalAlign) {
469
        switch ($verticalAlign) {
470
            case "bottom":
471
            case "middle":
472
            case "top":
473
            $this->verticalAlign = $verticalAlign;
474
            break;
475
        }
476
        return $this;
477
    }
478
479
    /**
480
     * Set the width.
481
     *
482
     * @param integer $width The width.
483
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
484
     */
485
    public function setWidth($width) {
486
        $this->width = $width;
487
        return $this;
488
    }
489
490
    /**
491
     * Set the y.
492
     *
493
     * @param integer $y The y.
494
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\Navigation\HighchartsButtonOptions Returns the highcharts button options.
495
     */
496
    public function setY($y) {
497
        $this->y = $y;
498
        return $this;
499
    }
500
501
    /**
502
     * Convert into an array representing this instance.
503
     *
504
     * @return array Returns an array representing this instance.
505
     */
506
    public function toArray() {
507
508
        // Initialize the output.
509
        $output = [];
510
511
        // Set the align.
512
        ArrayUtility::set($output, "align", $this->align, [null]);
513
514
        // Set the enabled.
515
        ArrayUtility::set($output, "enabled", $this->enabled, [null]);
516
517
        // Set the height.
518
        ArrayUtility::set($output, "height", $this->height, [null]);
519
520
        // Set the symbol fill.
521
        ArrayUtility::set($output, "symbolFill", $this->symbolFill, [null]);
522
523
        // Set the symbol size.
524
        ArrayUtility::set($output, "symbolSize", $this->symbolSize, [null]);
525
526
        // Set the symbol stroke.
527
        ArrayUtility::set($output, "symbolStroke", $this->symbolStroke, [null]);
528
529
        // Set the symbol stroke width.
530
        ArrayUtility::set($output, "symbolStrokeWidth", $this->symbolStrokeWidth, [null]);
531
532
        // Set the symbol x.
533
        ArrayUtility::set($output, "symbolX", $this->symbolX, [null]);
534
535
        // Set the symbol y.
536
        ArrayUtility::set($output, "symbolY", $this->symbolY, [null]);
537
538
        // Set the text.
539
        ArrayUtility::set($output, "text", $this->text, [null]);
540
541
        // Set the theme.
542
        ArrayUtility::set($output, "theme", $this->theme, [null]);
543
544
        // Set the vertical align.
545
        ArrayUtility::set($output, "verticalAlign", $this->verticalAlign, [null]);
546
547
        // Set the width.
548
        ArrayUtility::set($output, "width", $this->width, [null]);
549
550
        // Set the y.
551
        ArrayUtility::set($output, "y", $this->y, [null]);
552
553
        // Return the output.
554
        return $output;
555
    }
556
557
}
558