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 responsive. |
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 HighchartsResponsive implements JsonSerializable { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Rules. |
29
|
|
|
* |
30
|
|
|
* @var array |
31
|
|
|
* @since 5.0.0 |
32
|
|
|
*/ |
33
|
|
|
private $rules; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Constructor. |
37
|
|
|
* |
38
|
|
|
* @param boolean $ignoreDefaultValues Ignore the default values. |
39
|
|
|
*/ |
40
|
|
|
public function __construct($ignoreDefaultValues = true) { |
41
|
|
|
if (true === $ignoreDefaultValues) { |
42
|
|
|
$this->clear(); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Clear. |
48
|
|
|
* |
49
|
|
|
* @return void |
50
|
|
|
*/ |
51
|
|
|
public function clear() { |
52
|
|
|
|
53
|
|
|
// Clear the rules. |
54
|
|
|
$this->rules = null; |
|
|
|
|
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Get the rules. |
59
|
|
|
* |
60
|
|
|
* @return array Returns the rules. |
61
|
|
|
*/ |
62
|
|
|
public function getRules() { |
63
|
|
|
return $this->rules; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Serialize this instance. |
68
|
|
|
* |
69
|
|
|
* @return array Returns an array representing this instance. |
70
|
|
|
*/ |
71
|
|
|
public function jsonSerialize() { |
72
|
|
|
return $this->toArray(); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Set the rules. |
77
|
|
|
* |
78
|
|
|
* @param array $rules The rules. |
79
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsResponsive Returns the highcharts responsive. |
80
|
|
|
*/ |
81
|
|
|
public function setRules(array $rules = null) { |
82
|
|
|
$this->rules = $rules; |
|
|
|
|
83
|
|
|
return $this; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Convert into an array representing this instance. |
88
|
|
|
* |
89
|
|
|
* @return array Returns an array representing this instance. |
90
|
|
|
*/ |
91
|
|
|
public function toArray() { |
92
|
|
|
|
93
|
|
|
// Initialize the output. |
94
|
|
|
$output = []; |
95
|
|
|
|
96
|
|
|
// Set the rules. |
97
|
|
|
ArrayUtility::set($output, "rules", $this->rules, [null]); |
98
|
|
|
|
99
|
|
|
// Return the output. |
100
|
|
|
return $output; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
} |
104
|
|
|
|
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..