setSeriesDescriptionFormatter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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 accessibility.
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 HighchartsAccessibility implements JsonSerializable {
26
27
    /**
28
     * Describe single series.
29
     *
30
     * @var boolean
31
     * @since 5.0.0
32
     */
33
    private $describeSingleSeries = false;
34
35
    /**
36
     * Enabled.
37
     *
38
     * @var boolean
39
     * @since 5.0.0
40
     */
41
    private $enabled = true;
42
43
    /**
44
     * Keyboard navigation.
45
     *
46
     * @var array
47
     * @since 5.0.0
48
     */
49
    private $keyboardNavigation;
50
51
    /**
52
     * On table anchor click.
53
     *
54
     * @var string
55
     * @since 5.0.0
56
     */
57
    private $onTableAnchorClick;
58
59
    /**
60
     * Point date format.
61
     *
62
     * @var string
63
     * @since 5.0.0
64
     */
65
    private $pointDateFormat;
66
67
    /**
68
     * Point date formatter.
69
     *
70
     * @var string
71
     * @since 5.0.0
72
     */
73
    private $pointDateFormatter;
74
75
    /**
76
     * Point description formatter.
77
     *
78
     * @var string
79
     * @since 5.0.0
80
     */
81
    private $pointDescriptionFormatter;
82
83
    /**
84
     * Point description threshold.
85
     *
86
     * @var integer|boolean
87
     * @since 5.0.0
88
     */
89
    private $pointDescriptionThreshold = 30;
90
91
    /**
92
     * Screen reader section formatter.
93
     *
94
     * @var string
95
     * @since 5.0.0
96
     */
97
    private $screenReaderSectionFormatter;
98
99
    /**
100
     * Series description formatter.
101
     *
102
     * @var string
103
     * @since 5.0.0
104
     */
105
    private $seriesDescriptionFormatter;
106
107
    /**
108
     * Constructor.
109
     *
110
     * @param boolean $ignoreDefaultValues Ignore the default values.
111
     */
112
    public function __construct($ignoreDefaultValues = true) {
113
        if (true === $ignoreDefaultValues) {
114
            $this->clear();
115
        }
116
    }
117
118
    /**
119
     * Clear.
120
     *
121
     * @return void
122
     */
123
    public function clear() {
124
125
        // Clear the describe single series.
126
        $this->describeSingleSeries = null;
127
128
        // Clear the enabled.
129
        $this->enabled = null;
130
131
        // Clear the keyboard navigation.
132
        $this->keyboardNavigation = 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 $keyboardNavigation.

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...
133
134
        // Clear the on table anchor click.
135
        $this->onTableAnchorClick = null;
136
137
        // Clear the point date format.
138
        $this->pointDateFormat = null;
139
140
        // Clear the point date formatter.
141
        $this->pointDateFormatter = null;
142
143
        // Clear the point description formatter.
144
        $this->pointDescriptionFormatter = null;
145
146
        // Clear the point description threshold.
147
        $this->pointDescriptionThreshold = null;
148
149
        // Clear the screen reader section formatter.
150
        $this->screenReaderSectionFormatter = null;
151
152
        // Clear the series description formatter.
153
        $this->seriesDescriptionFormatter = null;
154
    }
155
156
    /**
157
     * Get the describe single series.
158
     *
159
     * @return boolean Returns the describe single series.
160
     */
161
    public function getDescribeSingleSeries() {
162
        return $this->describeSingleSeries;
163
    }
164
165
    /**
166
     * Get the enabled.
167
     *
168
     * @return boolean Returns the enabled.
169
     */
170
    public function getEnabled() {
171
        return $this->enabled;
172
    }
173
174
    /**
175
     * Get the keyboard navigation.
176
     *
177
     * @return array Returns the keyboard navigation.
178
     */
179
    public function getKeyboardNavigation() {
180
        return $this->keyboardNavigation;
181
    }
182
183
    /**
184
     * Get the on table anchor click.
185
     *
186
     * @return string Returns the on table anchor click.
187
     */
188
    public function getOnTableAnchorClick() {
189
        return $this->onTableAnchorClick;
190
    }
191
192
    /**
193
     * Get the point date format.
194
     *
195
     * @return string Returns the point date format.
196
     */
197
    public function getPointDateFormat() {
198
        return $this->pointDateFormat;
199
    }
200
201
    /**
202
     * Get the point date formatter.
203
     *
204
     * @return string Returns the point date formatter.
205
     */
206
    public function getPointDateFormatter() {
207
        return $this->pointDateFormatter;
208
    }
209
210
    /**
211
     * Get the point description formatter.
212
     *
213
     * @return string Returns the point description formatter.
214
     */
215
    public function getPointDescriptionFormatter() {
216
        return $this->pointDescriptionFormatter;
217
    }
218
219
    /**
220
     * Get the point description threshold.
221
     *
222
     * @return integer|boolean Returns the point description threshold.
223
     */
224
    public function getPointDescriptionThreshold() {
225
        return $this->pointDescriptionThreshold;
226
    }
227
228
    /**
229
     * Get the screen reader section formatter.
230
     *
231
     * @return string Returns the screen reader section formatter.
232
     */
233
    public function getScreenReaderSectionFormatter() {
234
        return $this->screenReaderSectionFormatter;
235
    }
236
237
    /**
238
     * Get the series description formatter.
239
     *
240
     * @return string Returns the series description formatter.
241
     */
242
    public function getSeriesDescriptionFormatter() {
243
        return $this->seriesDescriptionFormatter;
244
    }
245
246
    /**
247
     * Serialize this instance.
248
     *
249
     * @return array Returns an array representing this instance.
250
     */
251
    public function jsonSerialize() {
252
        return $this->toArray();
253
    }
254
255
    /**
256
     * Set the describe single series.
257
     *
258
     * @param boolean $describeSingleSeries The describe single series.
259
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
260
     */
261
    public function setDescribeSingleSeries($describeSingleSeries) {
262
        $this->describeSingleSeries = $describeSingleSeries;
263
        return $this;
264
    }
265
266
    /**
267
     * Set the enabled.
268
     *
269
     * @param boolean $enabled The enabled.
270
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
271
     */
272
    public function setEnabled($enabled) {
273
        $this->enabled = $enabled;
274
        return $this;
275
    }
276
277
    /**
278
     * Set the keyboard navigation.
279
     *
280
     * @param array $keyboardNavigation The keyboard navigation.
281
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
282
     */
283
    public function setKeyboardNavigation(array $keyboardNavigation = null) {
284
        $this->keyboardNavigation = $keyboardNavigation;
0 ignored issues
show
Documentation Bug introduced by
It seems like $keyboardNavigation can be null. However, the property $keyboardNavigation 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...
285
        return $this;
286
    }
287
288
    /**
289
     * Set the on table anchor click.
290
     *
291
     * @param string $onTableAnchorClick The on table anchor click.
292
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
293
     */
294
    public function setOnTableAnchorClick($onTableAnchorClick) {
295
        $this->onTableAnchorClick = $onTableAnchorClick;
296
        return $this;
297
    }
298
299
    /**
300
     * Set the point date format.
301
     *
302
     * @param string $pointDateFormat The point date format.
303
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
304
     */
305
    public function setPointDateFormat($pointDateFormat) {
306
        $this->pointDateFormat = $pointDateFormat;
307
        return $this;
308
    }
309
310
    /**
311
     * Set the point date formatter.
312
     *
313
     * @param string $pointDateFormatter The point date formatter.
314
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
315
     */
316
    public function setPointDateFormatter($pointDateFormatter) {
317
        $this->pointDateFormatter = $pointDateFormatter;
318
        return $this;
319
    }
320
321
    /**
322
     * Set the point description formatter.
323
     *
324
     * @param string $pointDescriptionFormatter The point description formatter.
325
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
326
     */
327
    public function setPointDescriptionFormatter($pointDescriptionFormatter) {
328
        $this->pointDescriptionFormatter = $pointDescriptionFormatter;
329
        return $this;
330
    }
331
332
    /**
333
     * Set the point description threshold.
334
     *
335
     * @param integer|boolean $pointDescriptionThreshold The point description threshold.
336
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
337
     */
338
    public function setPointDescriptionThreshold($pointDescriptionThreshold) {
339
        $this->pointDescriptionThreshold = $pointDescriptionThreshold;
340
        return $this;
341
    }
342
343
    /**
344
     * Set the screen reader section formatter.
345
     *
346
     * @param string $screenReaderSectionFormatter The screen reader section formatter.
347
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
348
     */
349
    public function setScreenReaderSectionFormatter($screenReaderSectionFormatter) {
350
        $this->screenReaderSectionFormatter = $screenReaderSectionFormatter;
351
        return $this;
352
    }
353
354
    /**
355
     * Set the series description formatter.
356
     *
357
     * @param string $seriesDescriptionFormatter The series description formatter.
358
     * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsAccessibility Returns the highcharts accessibility.
359
     */
360
    public function setSeriesDescriptionFormatter($seriesDescriptionFormatter) {
361
        $this->seriesDescriptionFormatter = $seriesDescriptionFormatter;
362
        return $this;
363
    }
364
365
    /**
366
     * Convert into an array representing this instance.
367
     *
368
     * @return array Returns an array representing this instance.
369
     */
370
    public function toArray() {
371
372
        // Initialize the output.
373
        $output = [];
374
375
        // Set the describe single series.
376
        ArrayUtility::set($output, "describeSingleSeries", $this->describeSingleSeries, [null]);
377
378
        // Set the enabled.
379
        ArrayUtility::set($output, "enabled", $this->enabled, [null]);
380
381
        // Set the keyboard navigation.
382
        ArrayUtility::set($output, "keyboardNavigation", $this->keyboardNavigation, [null]);
383
384
        // Set the on table anchor click.
385
        ArrayUtility::set($output, "onTableAnchorClick", $this->onTableAnchorClick, [null]);
386
387
        // Set the point date format.
388
        ArrayUtility::set($output, "pointDateFormat", $this->pointDateFormat, [null]);
389
390
        // Set the point date formatter.
391
        ArrayUtility::set($output, "pointDateFormatter", $this->pointDateFormatter, [null]);
392
393
        // Set the point description formatter.
394
        ArrayUtility::set($output, "pointDescriptionFormatter", $this->pointDescriptionFormatter, [null]);
395
396
        // Set the point description threshold.
397
        ArrayUtility::set($output, "pointDescriptionThreshold", $this->pointDescriptionThreshold, [null]);
398
399
        // Set the screen reader section formatter.
400
        ArrayUtility::set($output, "screenReaderSectionFormatter", $this->screenReaderSectionFormatter, [null]);
401
402
        // Set the series description formatter.
403
        ArrayUtility::set($output, "seriesDescriptionFormatter", $this->seriesDescriptionFormatter, [null]);
404
405
        // Return the output.
406
        return $output;
407
    }
408
409
}
410