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\Drilldown; |
13
|
|
|
|
14
|
|
|
use JsonSerializable; |
15
|
|
|
use WBW\Library\Core\Utility\Argument\ArrayUtility; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Highcharts drill up button. |
19
|
|
|
* |
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
21
|
|
|
* @package WBW\Bundle\HighchartsBundle\API\Chart\Drilldown |
22
|
|
|
* @version 5.0.14 |
23
|
|
|
* @final |
24
|
|
|
*/ |
25
|
|
|
final class HighchartsDrillUpButton implements JsonSerializable { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Position. |
29
|
|
|
* |
30
|
|
|
* @var array |
31
|
|
|
* @since 3.0.8 |
32
|
|
|
*/ |
33
|
|
|
private $position; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Relative to. |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
* @since 3.0.8 |
40
|
|
|
*/ |
41
|
|
|
private $relativeTo = "plotBox"; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Theme. |
45
|
|
|
* |
46
|
|
|
* @var array |
47
|
|
|
* @since 3.0.8 |
48
|
|
|
*/ |
49
|
|
|
private $theme; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Constructor. |
53
|
|
|
* |
54
|
|
|
* @param boolean $ignoreDefaultValues Ignore the default values. |
55
|
|
|
*/ |
56
|
|
|
public function __construct($ignoreDefaultValues = true) { |
57
|
|
|
if (true === $ignoreDefaultValues) { |
58
|
|
|
$this->clear(); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Clear. |
64
|
|
|
* |
65
|
|
|
* @return void |
66
|
|
|
*/ |
67
|
|
|
public function clear() { |
68
|
|
|
|
69
|
|
|
// Clear the position. |
70
|
|
|
$this->position = null; |
|
|
|
|
71
|
|
|
|
72
|
|
|
// Clear the relative to. |
73
|
|
|
$this->relativeTo = null; |
74
|
|
|
|
75
|
|
|
// Clear the theme. |
76
|
|
|
$this->theme = null; |
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Get the position. |
81
|
|
|
* |
82
|
|
|
* @return array Returns the position. |
83
|
|
|
*/ |
84
|
|
|
public function getPosition() { |
85
|
|
|
return $this->position; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Get the relative to. |
90
|
|
|
* |
91
|
|
|
* @return string Returns the relative to. |
92
|
|
|
*/ |
93
|
|
|
public function getRelativeTo() { |
94
|
|
|
return $this->relativeTo; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Get the theme. |
99
|
|
|
* |
100
|
|
|
* @return array Returns the theme. |
101
|
|
|
*/ |
102
|
|
|
public function getTheme() { |
103
|
|
|
return $this->theme; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Serialize this instance. |
108
|
|
|
* |
109
|
|
|
* @return array Returns an array representing this instance. |
110
|
|
|
*/ |
111
|
|
|
public function jsonSerialize() { |
112
|
|
|
return $this->toArray(); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Set the position. |
117
|
|
|
* |
118
|
|
|
* @param array $position The position. |
119
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\Drilldown\HighchartsDrillUpButton Returns the highcharts drill up button. |
120
|
|
|
*/ |
121
|
|
|
public function setPosition(array $position = null) { |
122
|
|
|
$this->position = $position; |
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Set the relative to. |
128
|
|
|
* |
129
|
|
|
* @param string $relativeTo The relative to. |
130
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\Drilldown\HighchartsDrillUpButton Returns the highcharts drill up button. |
131
|
|
|
*/ |
132
|
|
|
public function setRelativeTo($relativeTo) { |
133
|
|
|
$this->relativeTo = $relativeTo; |
134
|
|
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Set the theme. |
139
|
|
|
* |
140
|
|
|
* @param array $theme The theme. |
141
|
|
|
* @return \WBW\Bundle\HighchartsBundle\API\Chart\Drilldown\HighchartsDrillUpButton Returns the highcharts drill up button. |
142
|
|
|
*/ |
143
|
|
|
public function setTheme(array $theme = null) { |
144
|
|
|
$this->theme = $theme; |
|
|
|
|
145
|
|
|
return $this; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Convert into an array representing this instance. |
150
|
|
|
* |
151
|
|
|
* @return array Returns an array representing this instance. |
152
|
|
|
*/ |
153
|
|
|
public function toArray() { |
154
|
|
|
|
155
|
|
|
// Initialize the output. |
156
|
|
|
$output = []; |
157
|
|
|
|
158
|
|
|
// Set the position. |
159
|
|
|
ArrayUtility::set($output, "position", $this->position, [null]); |
160
|
|
|
|
161
|
|
|
// Set the relative to. |
162
|
|
|
ArrayUtility::set($output, "relativeTo", $this->relativeTo, [null]); |
163
|
|
|
|
164
|
|
|
// Set the theme. |
165
|
|
|
ArrayUtility::set($output, "theme", $this->theme, [null]); |
166
|
|
|
|
167
|
|
|
// Return the output. |
168
|
|
|
return $output; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
} |
172
|
|
|
|
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..