| Total Complexity | 40 |
| Total Lines | 500 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like LineDataSet often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use LineDataSet, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 11 | class LineDataSet extends DataSet |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var bool|string |
||
| 15 | */ |
||
| 16 | protected $fill; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $cubicInterpolationMode; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var int |
||
| 25 | */ |
||
| 26 | protected $lineTension; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var string |
||
| 30 | */ |
||
| 31 | protected $borderCapStyle; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var array |
||
| 35 | */ |
||
| 36 | protected $borderDash; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var float |
||
| 40 | */ |
||
| 41 | protected $borderDashOffset; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var string |
||
| 45 | */ |
||
| 46 | protected $borderJoinStyle; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @var string|string[] |
||
| 50 | */ |
||
| 51 | protected $pointBorderColor; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var string|string[] |
||
| 55 | */ |
||
| 56 | protected $pointBackgroundColor; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var int|int[] |
||
| 60 | */ |
||
| 61 | protected $pointBorderWidth; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @var int|int[] |
||
| 65 | */ |
||
| 66 | protected $pointRadius; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var int|int[] |
||
| 70 | */ |
||
| 71 | protected $pointHoverRadius; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @var int|int[] |
||
| 75 | */ |
||
| 76 | protected $pointHitRadius; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @var string|string[] |
||
| 80 | */ |
||
| 81 | protected $pointHoverBackgroundColor; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @var string|string[] |
||
| 85 | */ |
||
| 86 | protected $pointHoverBorderColor; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var int|int[] |
||
| 90 | */ |
||
| 91 | protected $pointHoverBorderWidth; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @var mixed |
||
| 95 | */ |
||
| 96 | protected $pointStyle; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var bool |
||
| 100 | */ |
||
| 101 | protected $showLine; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @var bool |
||
| 105 | */ |
||
| 106 | protected $spanGaps; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @var bool |
||
| 110 | */ |
||
| 111 | protected $steppedLine; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @return bool|string |
||
| 115 | */ |
||
| 116 | public function getFill() |
||
| 117 | { |
||
| 118 | return $this->fill; |
||
| 119 | } |
||
| 120 | |||
| 121 | /** |
||
| 122 | * @param bool|string $fill |
||
| 123 | * |
||
| 124 | * @return $this |
||
| 125 | */ |
||
| 126 | public function setFill($fill) |
||
| 127 | { |
||
| 128 | $this->fill = $fill; |
||
| 129 | |||
| 130 | return $this; |
||
| 131 | } |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @return string |
||
| 135 | */ |
||
| 136 | public function getCubicInterpolationMode() |
||
| 137 | { |
||
| 138 | return $this->cubicInterpolationMode; |
||
| 139 | } |
||
| 140 | |||
| 141 | /** |
||
| 142 | * @param string $cubicInterpolationMode |
||
| 143 | * |
||
| 144 | * @return $this |
||
| 145 | */ |
||
| 146 | public function setCubicInterpolationMode($cubicInterpolationMode) |
||
| 147 | { |
||
| 148 | $this->cubicInterpolationMode = $cubicInterpolationMode; |
||
| 149 | |||
| 150 | return $this; |
||
| 151 | } |
||
| 152 | |||
| 153 | /** |
||
| 154 | * @return int |
||
| 155 | */ |
||
| 156 | public function getLineTension() |
||
| 157 | { |
||
| 158 | return $this->lineTension; |
||
| 159 | } |
||
| 160 | |||
| 161 | /** |
||
| 162 | * @param float $lineTension |
||
| 163 | * |
||
| 164 | * @return $this |
||
| 165 | */ |
||
| 166 | public function setLineTension($lineTension) |
||
| 167 | { |
||
| 168 | $this->lineTension = floatval($lineTension); |
||
| 169 | |||
| 170 | return $this; |
||
| 171 | } |
||
| 172 | |||
| 173 | /** |
||
| 174 | * @return string |
||
| 175 | */ |
||
| 176 | public function getBorderCapStyle() |
||
| 177 | { |
||
| 178 | return $this->borderCapStyle; |
||
| 179 | } |
||
| 180 | |||
| 181 | /** |
||
| 182 | * @param string $borderCapStyle |
||
| 183 | * |
||
| 184 | * @return $this |
||
| 185 | */ |
||
| 186 | public function setBorderCapStyle($borderCapStyle) |
||
| 187 | { |
||
| 188 | $this->borderCapStyle = $borderCapStyle; |
||
| 189 | |||
| 190 | return $this; |
||
| 191 | } |
||
| 192 | |||
| 193 | /** |
||
| 194 | * @return array |
||
| 195 | */ |
||
| 196 | public function getBorderDash() |
||
| 197 | { |
||
| 198 | return $this->borderDash; |
||
| 199 | } |
||
| 200 | |||
| 201 | /** |
||
| 202 | * @param array $borderDash |
||
| 203 | * |
||
| 204 | * @return $this |
||
| 205 | */ |
||
| 206 | public function setBorderDash($borderDash) |
||
| 207 | { |
||
| 208 | $this->borderDash = $borderDash; |
||
| 209 | |||
| 210 | return $this; |
||
| 211 | } |
||
| 212 | |||
| 213 | /** |
||
| 214 | * @return int |
||
| 215 | */ |
||
| 216 | public function getBorderDashOffset() |
||
| 217 | { |
||
| 218 | return $this->borderDashOffset; |
||
| 219 | } |
||
| 220 | |||
| 221 | /** |
||
| 222 | * @param float $borderDashOffset |
||
| 223 | * |
||
| 224 | * @return $this |
||
| 225 | */ |
||
| 226 | public function setBorderDashOffset($borderDashOffset) |
||
| 227 | { |
||
| 228 | $this->borderDashOffset = floatval($borderDashOffset); |
||
| 229 | |||
| 230 | return $this; |
||
| 231 | } |
||
| 232 | |||
| 233 | /** |
||
| 234 | * @return string |
||
| 235 | */ |
||
| 236 | public function getBorderJoinStyle() |
||
| 237 | { |
||
| 238 | return $this->borderJoinStyle; |
||
| 239 | } |
||
| 240 | |||
| 241 | /** |
||
| 242 | * @param string $borderJoinStyle |
||
| 243 | * |
||
| 244 | * @return $this |
||
| 245 | */ |
||
| 246 | public function setBorderJoinStyle($borderJoinStyle) |
||
| 247 | { |
||
| 248 | $this->borderJoinStyle = $borderJoinStyle; |
||
| 249 | |||
| 250 | return $this; |
||
| 251 | } |
||
| 252 | |||
| 253 | /** |
||
| 254 | * @return string|string[] |
||
| 255 | */ |
||
| 256 | public function getPointBorderColor() |
||
| 257 | { |
||
| 258 | return $this->pointBorderColor; |
||
| 259 | } |
||
| 260 | |||
| 261 | /** |
||
| 262 | * @param string|string[] $pointBorderColor |
||
| 263 | * |
||
| 264 | * @return $this |
||
| 265 | */ |
||
| 266 | public function setPointBorderColor($pointBorderColor) |
||
| 267 | { |
||
| 268 | $this->pointBorderColor = $pointBorderColor; |
||
| 269 | |||
| 270 | return $this; |
||
| 271 | } |
||
| 272 | |||
| 273 | /** |
||
| 274 | * @return string|string[] |
||
| 275 | */ |
||
| 276 | public function getPointBackgroundColor() |
||
| 277 | { |
||
| 278 | return $this->pointBackgroundColor; |
||
| 279 | } |
||
| 280 | |||
| 281 | /** |
||
| 282 | * @param string|string[] $pointBackgroundColor |
||
| 283 | * |
||
| 284 | * @return $this |
||
| 285 | */ |
||
| 286 | public function setPointBackgroundColor($pointBackgroundColor) |
||
| 291 | } |
||
| 292 | |||
| 293 | /** |
||
| 294 | * @return int|int[] |
||
| 295 | */ |
||
| 296 | public function getPointBorderWidth() |
||
| 297 | { |
||
| 298 | return $this->pointBorderWidth; |
||
| 299 | } |
||
| 300 | |||
| 301 | /** |
||
| 302 | * @param int|int[] $pointBorderWidth |
||
| 303 | * |
||
| 304 | * @return $this |
||
| 305 | */ |
||
| 306 | public function setPointBorderWidth($pointBorderWidth) |
||
| 307 | { |
||
| 308 | $this->pointBorderWidth = $pointBorderWidth; |
||
| 309 | |||
| 310 | return $this; |
||
| 311 | } |
||
| 312 | |||
| 313 | /** |
||
| 314 | * @return int|int[] |
||
| 315 | */ |
||
| 316 | public function getPointRadius() |
||
| 317 | { |
||
| 318 | return $this->pointRadius; |
||
| 319 | } |
||
| 320 | |||
| 321 | /** |
||
| 322 | * @param int|int[] $pointRadius |
||
| 323 | * |
||
| 324 | * @return $this |
||
| 325 | */ |
||
| 326 | public function setPointRadius($pointRadius) |
||
| 327 | { |
||
| 328 | $this->pointRadius = $pointRadius; |
||
| 329 | |||
| 330 | return $this; |
||
| 331 | } |
||
| 332 | |||
| 333 | /** |
||
| 334 | * @return int|int[] |
||
| 335 | */ |
||
| 336 | public function getPointHoverRadius() |
||
| 337 | { |
||
| 338 | return $this->pointHoverRadius; |
||
| 339 | } |
||
| 340 | |||
| 341 | /** |
||
| 342 | * @param int|int[] $pointHoverRadius |
||
| 343 | * |
||
| 344 | * @return $this |
||
| 345 | */ |
||
| 346 | public function setPointHoverRadius($pointHoverRadius) |
||
| 347 | { |
||
| 348 | $this->pointHoverRadius = $pointHoverRadius; |
||
| 349 | |||
| 350 | return $this; |
||
| 351 | } |
||
| 352 | |||
| 353 | /** |
||
| 354 | * @return int|int[] |
||
| 355 | */ |
||
| 356 | public function getPointHitRadius() |
||
| 357 | { |
||
| 358 | return $this->pointHitRadius; |
||
| 359 | } |
||
| 360 | |||
| 361 | /** |
||
| 362 | * @param int|int[] $pointHitRadius |
||
| 363 | * |
||
| 364 | * @return $this |
||
| 365 | */ |
||
| 366 | public function setPointHitRadius($pointHitRadius) |
||
| 367 | { |
||
| 368 | $this->pointHitRadius = $pointHitRadius; |
||
| 369 | |||
| 370 | return $this; |
||
| 371 | } |
||
| 372 | |||
| 373 | /** |
||
| 374 | * @return string|string[] |
||
| 375 | */ |
||
| 376 | public function getPointHoverBackgroundColor() |
||
| 379 | } |
||
| 380 | |||
| 381 | /** |
||
| 382 | * @param string|string[] $pointHoverBackgroundColor |
||
| 383 | * |
||
| 384 | * @return $this |
||
| 385 | */ |
||
| 386 | public function setPointHoverBackgroundColor($pointHoverBackgroundColor) |
||
| 387 | { |
||
| 388 | $this->pointHoverBackgroundColor = $pointHoverBackgroundColor; |
||
| 389 | |||
| 390 | return $this; |
||
| 391 | } |
||
| 392 | |||
| 393 | /** |
||
| 394 | * @return string|string[] |
||
| 395 | */ |
||
| 396 | public function getPointHoverBorderColor() |
||
| 399 | } |
||
| 400 | |||
| 401 | /** |
||
| 402 | * @param string|string[] $pointHoverBorderColor |
||
| 403 | * |
||
| 404 | * @return $this |
||
| 405 | */ |
||
| 406 | public function setPointHoverBorderColor($pointHoverBorderColor) |
||
| 407 | { |
||
| 408 | $this->pointHoverBorderColor = $pointHoverBorderColor; |
||
| 409 | |||
| 410 | return $this; |
||
| 411 | } |
||
| 412 | |||
| 413 | /** |
||
| 414 | * @return int|int[] |
||
| 415 | */ |
||
| 416 | public function getPointHoverBorderWidth() |
||
| 417 | { |
||
| 418 | return $this->pointHoverBorderWidth; |
||
| 419 | } |
||
| 420 | |||
| 421 | /** |
||
| 422 | * @param int|int[] $pointHoverBorderWidth |
||
| 423 | * |
||
| 424 | * @return $this |
||
| 425 | */ |
||
| 426 | public function setPointHoverBorderWidth($pointHoverBorderWidth) |
||
| 427 | { |
||
| 428 | $this->pointHoverBorderWidth = $pointHoverBorderWidth; |
||
| 429 | |||
| 430 | return $this; |
||
| 431 | } |
||
| 432 | |||
| 433 | /** |
||
| 434 | * @return mixed |
||
| 435 | */ |
||
| 436 | public function getPointStyle() |
||
| 437 | { |
||
| 438 | return $this->pointStyle; |
||
| 439 | } |
||
| 440 | |||
| 441 | /** |
||
| 442 | * @param mixed $pointStyle |
||
| 443 | * |
||
| 444 | * @return $this |
||
| 445 | */ |
||
| 446 | public function setPointStyle($pointStyle) |
||
| 447 | { |
||
| 448 | $this->pointStyle = $pointStyle; |
||
| 449 | |||
| 450 | return $this; |
||
| 451 | } |
||
| 452 | |||
| 453 | /** |
||
| 454 | * @return bool |
||
| 455 | */ |
||
| 456 | public function isShowLine() |
||
| 457 | { |
||
| 458 | return $this->showLine; |
||
| 459 | } |
||
| 460 | |||
| 461 | /** |
||
| 462 | * @param bool $showLine |
||
| 463 | * |
||
| 464 | * @return $this |
||
| 465 | */ |
||
| 466 | public function setShowLine($showLine) |
||
| 471 | } |
||
| 472 | |||
| 473 | /** |
||
| 474 | * @return bool |
||
| 475 | */ |
||
| 476 | public function isSpanGaps() |
||
| 477 | { |
||
| 478 | return $this->spanGaps; |
||
| 479 | } |
||
| 480 | |||
| 481 | /** |
||
| 482 | * @param bool $spanGaps |
||
| 483 | * |
||
| 484 | * @return $this |
||
| 485 | */ |
||
| 486 | public function setSpanGaps($spanGaps) |
||
| 487 | { |
||
| 488 | $this->spanGaps = $spanGaps; |
||
| 489 | |||
| 490 | return $this; |
||
| 491 | } |
||
| 492 | |||
| 493 | /** |
||
| 494 | * @return bool |
||
| 495 | */ |
||
| 496 | public function isSteppedLine() |
||
| 499 | } |
||
| 500 | |||
| 501 | /** |
||
| 502 | * @param bool $steppedLine |
||
| 503 | * |
||
| 504 | * @return $this |
||
| 505 | */ |
||
| 506 | public function setSteppedLine($steppedLine) |
||
| 507 | { |
||
| 508 | $this->steppedLine = $steppedLine; |
||
| 509 | |||
| 511 | } |
||
| 512 | } |
||
| 513 |