webeweb /
highcharts-bundle
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 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 title. |
||
| 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 HighchartsTitle implements JsonSerializable { |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Align. |
||
| 29 | * |
||
| 30 | * @var string |
||
| 31 | * @since 2.0 |
||
| 32 | */ |
||
| 33 | private $align = "center"; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Floating. |
||
| 37 | * |
||
| 38 | * @var boolean |
||
| 39 | * @since 2.1 |
||
| 40 | */ |
||
| 41 | private $floating = false; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Margin. |
||
| 45 | * |
||
| 46 | * @var integer |
||
| 47 | * @since 2.1 |
||
| 48 | */ |
||
| 49 | private $margin = 15; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Style. |
||
| 53 | * |
||
| 54 | * @var array |
||
| 55 | */ |
||
| 56 | private $style = ["color" => "#333333", "fontSize" => "18px"]; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Text. |
||
| 60 | * |
||
| 61 | * @var string |
||
| 62 | */ |
||
| 63 | private $text = "Chart title"; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Use HTML. |
||
| 67 | * |
||
| 68 | * @var boolean |
||
| 69 | */ |
||
| 70 | private $useHTML = false; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Vertical align. |
||
| 74 | * |
||
| 75 | * @var string |
||
| 76 | * @since 2.1 |
||
| 77 | */ |
||
| 78 | private $verticalAlign; |
||
| 79 | |||
| 80 | /** |
||
| 81 | * Width adjust. |
||
| 82 | * |
||
| 83 | * @var integer |
||
| 84 | * @since 4.2.5 |
||
| 85 | */ |
||
| 86 | private $widthAdjust = -44; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * X. |
||
| 90 | * |
||
| 91 | * @var integer |
||
| 92 | * @since 2.0 |
||
| 93 | */ |
||
| 94 | private $x = 0; |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Y. |
||
| 98 | * |
||
| 99 | * @var integer |
||
| 100 | * @since 2.0 |
||
| 101 | */ |
||
| 102 | private $y; |
||
| 103 | |||
| 104 | /** |
||
| 105 | * Constructor. |
||
| 106 | * |
||
| 107 | * @param boolean $ignoreDefaultValues Ignore the default values. |
||
| 108 | */ |
||
| 109 | public function __construct($ignoreDefaultValues = true) { |
||
| 110 | if (true === $ignoreDefaultValues) { |
||
| 111 | $this->clear(); |
||
| 112 | } |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Clear. |
||
| 117 | * |
||
| 118 | * @return void |
||
| 119 | */ |
||
| 120 | public function clear() { |
||
| 121 | |||
| 122 | // Clear the align. |
||
| 123 | $this->align = null; |
||
| 124 | |||
| 125 | // Clear the floating. |
||
| 126 | $this->floating = null; |
||
| 127 | |||
| 128 | // Clear the margin. |
||
| 129 | $this->margin = null; |
||
| 130 | |||
| 131 | // Clear the style. |
||
| 132 | $this->style = null; |
||
|
0 ignored issues
–
show
|
|||
| 133 | |||
| 134 | // Clear the text. |
||
| 135 | $this->text = null; |
||
| 136 | |||
| 137 | // Clear the use HTML. |
||
| 138 | $this->useHTML = null; |
||
| 139 | |||
| 140 | // Clear the vertical align. |
||
| 141 | $this->verticalAlign = null; |
||
| 142 | |||
| 143 | // Clear the width adjust. |
||
| 144 | $this->widthAdjust = null; |
||
| 145 | |||
| 146 | // Clear the x. |
||
| 147 | $this->x = null; |
||
| 148 | |||
| 149 | // Clear the y. |
||
| 150 | $this->y = null; |
||
| 151 | } |
||
| 152 | |||
| 153 | /** |
||
| 154 | * Get the align. |
||
| 155 | * |
||
| 156 | * @return string Returns the align. |
||
| 157 | */ |
||
| 158 | public function getAlign() { |
||
| 159 | return $this->align; |
||
| 160 | } |
||
| 161 | |||
| 162 | /** |
||
| 163 | * Get the floating. |
||
| 164 | * |
||
| 165 | * @return boolean Returns the floating. |
||
| 166 | */ |
||
| 167 | public function getFloating() { |
||
| 168 | return $this->floating; |
||
| 169 | } |
||
| 170 | |||
| 171 | /** |
||
| 172 | * Get the margin. |
||
| 173 | * |
||
| 174 | * @return integer Returns the margin. |
||
| 175 | */ |
||
| 176 | public function getMargin() { |
||
| 177 | return $this->margin; |
||
| 178 | } |
||
| 179 | |||
| 180 | /** |
||
| 181 | * Get the style. |
||
| 182 | * |
||
| 183 | * @return array Returns the style. |
||
| 184 | */ |
||
| 185 | public function getStyle() { |
||
| 186 | return $this->style; |
||
| 187 | } |
||
| 188 | |||
| 189 | /** |
||
| 190 | * Get the text. |
||
| 191 | * |
||
| 192 | * @return string Returns the text. |
||
| 193 | */ |
||
| 194 | public function getText() { |
||
| 195 | return $this->text; |
||
| 196 | } |
||
| 197 | |||
| 198 | /** |
||
| 199 | * Get the use HTML. |
||
| 200 | * |
||
| 201 | * @return boolean Returns the use HTML. |
||
| 202 | */ |
||
| 203 | public function getUseHTML() { |
||
| 204 | return $this->useHTML; |
||
| 205 | } |
||
| 206 | |||
| 207 | /** |
||
| 208 | * Get the vertical align. |
||
| 209 | * |
||
| 210 | * @return string Returns the vertical align. |
||
| 211 | */ |
||
| 212 | public function getVerticalAlign() { |
||
| 213 | return $this->verticalAlign; |
||
| 214 | } |
||
| 215 | |||
| 216 | /** |
||
| 217 | * Get the width adjust. |
||
| 218 | * |
||
| 219 | * @return integer Returns the width adjust. |
||
| 220 | */ |
||
| 221 | public function getWidthAdjust() { |
||
| 222 | return $this->widthAdjust; |
||
| 223 | } |
||
| 224 | |||
| 225 | /** |
||
| 226 | * Get the x. |
||
| 227 | * |
||
| 228 | * @return integer Returns the x. |
||
| 229 | */ |
||
| 230 | public function getX() { |
||
| 231 | return $this->x; |
||
| 232 | } |
||
| 233 | |||
| 234 | /** |
||
| 235 | * Get the y. |
||
| 236 | * |
||
| 237 | * @return integer Returns the y. |
||
| 238 | */ |
||
| 239 | public function getY() { |
||
| 240 | return $this->y; |
||
| 241 | } |
||
| 242 | |||
| 243 | /** |
||
| 244 | * Serialize this instance. |
||
| 245 | * |
||
| 246 | * @return array Returns an array representing this instance. |
||
| 247 | */ |
||
| 248 | public function jsonSerialize() { |
||
| 249 | return $this->toArray(); |
||
| 250 | } |
||
| 251 | |||
| 252 | /** |
||
| 253 | * Set the align. |
||
| 254 | * |
||
| 255 | * @param string $align The align. |
||
| 256 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 257 | */ |
||
| 258 | public function setAlign($align) { |
||
| 259 | switch ($align) { |
||
| 260 | case "center": |
||
| 261 | case "left": |
||
| 262 | case "right": |
||
| 263 | $this->align = $align; |
||
| 264 | break; |
||
| 265 | } |
||
| 266 | return $this; |
||
| 267 | } |
||
| 268 | |||
| 269 | /** |
||
| 270 | * Set the floating. |
||
| 271 | * |
||
| 272 | * @param boolean $floating The floating. |
||
| 273 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 274 | */ |
||
| 275 | public function setFloating($floating) { |
||
| 276 | $this->floating = $floating; |
||
| 277 | return $this; |
||
| 278 | } |
||
| 279 | |||
| 280 | /** |
||
| 281 | * Set the margin. |
||
| 282 | * |
||
| 283 | * @param integer $margin The margin. |
||
| 284 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 285 | */ |
||
| 286 | public function setMargin($margin) { |
||
| 287 | $this->margin = $margin; |
||
| 288 | return $this; |
||
| 289 | } |
||
| 290 | |||
| 291 | /** |
||
| 292 | * Set the style. |
||
| 293 | * |
||
| 294 | * @param array $style The style. |
||
| 295 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 296 | */ |
||
| 297 | public function setStyle(array $style = null) { |
||
| 298 | $this->style = $style; |
||
|
0 ignored issues
–
show
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 Loading history...
|
|||
| 299 | return $this; |
||
| 300 | } |
||
| 301 | |||
| 302 | /** |
||
| 303 | * Set the text. |
||
| 304 | * |
||
| 305 | * @param string $text The text. |
||
| 306 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 307 | */ |
||
| 308 | public function setText($text) { |
||
| 309 | $this->text = $text; |
||
| 310 | return $this; |
||
| 311 | } |
||
| 312 | |||
| 313 | /** |
||
| 314 | * Set the use HTML. |
||
| 315 | * |
||
| 316 | * @param boolean $useHTML The use HTML. |
||
| 317 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 318 | */ |
||
| 319 | public function setUseHTML($useHTML) { |
||
| 320 | $this->useHTML = $useHTML; |
||
| 321 | return $this; |
||
| 322 | } |
||
| 323 | |||
| 324 | /** |
||
| 325 | * Set the vertical align. |
||
| 326 | * |
||
| 327 | * @param string $verticalAlign The vertical align. |
||
| 328 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 329 | */ |
||
| 330 | public function setVerticalAlign($verticalAlign) { |
||
| 331 | switch ($verticalAlign) { |
||
| 332 | case "bottom": |
||
| 333 | case "middle": |
||
| 334 | case "top": |
||
| 335 | $this->verticalAlign = $verticalAlign; |
||
| 336 | break; |
||
| 337 | } |
||
| 338 | return $this; |
||
| 339 | } |
||
| 340 | |||
| 341 | /** |
||
| 342 | * Set the width adjust. |
||
| 343 | * |
||
| 344 | * @param integer $widthAdjust The width adjust. |
||
| 345 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 346 | */ |
||
| 347 | public function setWidthAdjust($widthAdjust) { |
||
| 348 | $this->widthAdjust = $widthAdjust; |
||
| 349 | return $this; |
||
| 350 | } |
||
| 351 | |||
| 352 | /** |
||
| 353 | * Set the x. |
||
| 354 | * |
||
| 355 | * @param integer $x The x. |
||
| 356 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 357 | */ |
||
| 358 | public function setX($x) { |
||
| 359 | $this->x = $x; |
||
| 360 | return $this; |
||
| 361 | } |
||
| 362 | |||
| 363 | /** |
||
| 364 | * Set the y. |
||
| 365 | * |
||
| 366 | * @param integer $y The y. |
||
| 367 | * @return \WBW\Bundle\HighchartsBundle\API\Chart\HighchartsTitle Returns the highcharts title. |
||
| 368 | */ |
||
| 369 | public function setY($y) { |
||
| 370 | $this->y = $y; |
||
| 371 | return $this; |
||
| 372 | } |
||
| 373 | |||
| 374 | /** |
||
| 375 | * Convert into an array representing this instance. |
||
| 376 | * |
||
| 377 | * @return array Returns an array representing this instance. |
||
| 378 | */ |
||
| 379 | public function toArray() { |
||
| 380 | |||
| 381 | // Initialize the output. |
||
| 382 | $output = []; |
||
| 383 | |||
| 384 | // Set the align. |
||
| 385 | ArrayUtility::set($output, "align", $this->align, [null]); |
||
| 386 | |||
| 387 | // Set the floating. |
||
| 388 | ArrayUtility::set($output, "floating", $this->floating, [null]); |
||
| 389 | |||
| 390 | // Set the margin. |
||
| 391 | ArrayUtility::set($output, "margin", $this->margin, [null]); |
||
| 392 | |||
| 393 | // Set the style. |
||
| 394 | ArrayUtility::set($output, "style", $this->style, [null]); |
||
| 395 | |||
| 396 | // Set the text. |
||
| 397 | ArrayUtility::set($output, "text", $this->text, [null]); |
||
| 398 | |||
| 399 | // Set the use HTML. |
||
| 400 | ArrayUtility::set($output, "useHTML", $this->useHTML, [null]); |
||
| 401 | |||
| 402 | // Set the vertical align. |
||
| 403 | ArrayUtility::set($output, "verticalAlign", $this->verticalAlign, [null]); |
||
| 404 | |||
| 405 | // Set the width adjust. |
||
| 406 | ArrayUtility::set($output, "widthAdjust", $this->widthAdjust, [null]); |
||
| 407 | |||
| 408 | // Set the x. |
||
| 409 | ArrayUtility::set($output, "x", $this->x, [null]); |
||
| 410 | |||
| 411 | // Set the y. |
||
| 412 | ArrayUtility::set($output, "y", $this->y, [null]); |
||
| 413 | |||
| 414 | // Return the output. |
||
| 415 | return $output; |
||
| 416 | } |
||
| 417 | |||
| 418 | } |
||
| 419 |
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..