| Total Complexity | 50 |
| Total Lines | 715 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like SkuskuProduct 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 SkuskuProduct, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 18 | class SkuskuProduct implements ClonableInterface, SkuskuProductInterface |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var integer |
||
| 22 | * |
||
| 23 | * @ORM\Column(name="id", type="integer") |
||
| 24 | * @ORM\Id |
||
| 25 | * @ORM\GeneratedValue(strategy="IDENTITY") |
||
| 26 | */ |
||
| 27 | private $id; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var string |
||
| 31 | * |
||
| 32 | * @ORM\Column(name="code", type="string", length=50) |
||
| 33 | * @ClonableProperty(type="prefix") |
||
| 34 | */ |
||
| 35 | private $code; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var string |
||
| 39 | * |
||
| 40 | * @ORM\Column(name="title", type="string", length=70) |
||
| 41 | * @ClonableProperty() |
||
| 42 | */ |
||
| 43 | private $title; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @var string |
||
| 47 | * |
||
| 48 | * @ORM\Column(name="description", type="text", nullable=true) |
||
| 49 | */ |
||
| 50 | private $description; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @var string |
||
| 54 | * |
||
| 55 | * @ORM\Column(name="description_short", type="text", nullable=true) |
||
| 56 | */ |
||
| 57 | private $descriptionShort; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @var ? |
||
| 61 | * |
||
| 62 | * @ORM\Column(name="collection", type="text", nullable=true) |
||
| 63 | */ |
||
| 64 | private $collection; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @var string |
||
| 68 | * |
||
| 69 | * @ORM\Column(name="departure_place", type="string", length=70, nullable=true) |
||
| 70 | * @ClonableProperty(type="replace", value="Firenze S.M.N.") |
||
| 71 | */ |
||
| 72 | private $departurePlace; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @var \DateTime |
||
| 76 | * |
||
| 77 | * @ORM\Column(name="departure_time", type="datetime", nullable=true) |
||
| 78 | */ |
||
| 79 | private $departureTime; |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @var string |
||
| 83 | * |
||
| 84 | * @ORM\Column(name="return_place", type="string", length=70, nullable=true) |
||
| 85 | */ |
||
| 86 | private $returnPlace; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var \DateTime |
||
| 90 | * |
||
| 91 | * @ORM\Column(name="return_time", type="datetime", nullable=true) |
||
| 92 | */ |
||
| 93 | private $returnTime; |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @var string |
||
| 97 | * |
||
| 98 | * @ORM\Column(name="state_code", type="string", length=70, nullable=true) |
||
| 99 | */ |
||
| 100 | private $stateCode; |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @var string |
||
| 104 | * |
||
| 105 | * @ORM\Column(name="full_price", type="decimal", precision=6, scale=2) |
||
| 106 | */ |
||
| 107 | private $fullPrice; |
||
| 108 | |||
| 109 | /** |
||
| 110 | * @var string |
||
| 111 | * |
||
| 112 | * @ORM\Column(name="web", type="string", length=100, nullable=true) |
||
| 113 | */ |
||
| 114 | private $web; |
||
| 115 | |||
| 116 | /** |
||
| 117 | * @var \DateTime |
||
| 118 | * |
||
| 119 | * @ORM\Column(name="release_time", type="datetime", nullable=true) |
||
| 120 | */ |
||
| 121 | private $relaseTime; |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @var string |
||
| 125 | * |
||
| 126 | * @ORM\Column(name="highlights", type="text", nullable=true) |
||
| 127 | */ |
||
| 128 | private $highlights; |
||
| 129 | |||
| 130 | /** |
||
| 131 | * @var string |
||
| 132 | * |
||
| 133 | * @ORM\Column(name="inclusion", type="text", nullable=true) |
||
| 134 | */ |
||
| 135 | private $inclusion; |
||
| 136 | |||
| 137 | /** |
||
| 138 | * @var string |
||
| 139 | * |
||
| 140 | * @ORM\Column(name="exclusion", type="text", nullable=true) |
||
| 141 | */ |
||
| 142 | private $exclusion; |
||
| 143 | |||
| 144 | /** |
||
| 145 | * @var \DateTime |
||
| 146 | * |
||
| 147 | * @ORM\Column(name="available_from", type="datetime") |
||
| 148 | */ |
||
| 149 | private $availableFrom; |
||
| 150 | |||
| 151 | /** |
||
| 152 | * @var \DateTime |
||
| 153 | * |
||
| 154 | * @ORM\Column(name="available_to", type="datetime") |
||
| 155 | */ |
||
| 156 | private $availableTo; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @var string |
||
| 160 | * |
||
| 161 | * @ORM\Column(name="info", type="text", nullable=true) |
||
| 162 | */ |
||
| 163 | private $info; |
||
| 164 | |||
| 165 | /** |
||
| 166 | * @var int |
||
| 167 | * |
||
| 168 | * @ORM\Column(name="voucher", type="integer", nullable=true) |
||
| 169 | */ |
||
| 170 | private $voucher; |
||
| 171 | |||
| 172 | /** |
||
| 173 | * @var string |
||
| 174 | * |
||
| 175 | * @ORM\Column(name="meeting_point", type="text", nullable=true) |
||
| 176 | */ |
||
| 177 | private $meetingPoint; |
||
| 178 | |||
| 179 | /** |
||
| 180 | * @return string |
||
| 181 | */ |
||
| 182 | public function __toString() |
||
| 183 | { |
||
| 184 | return $this->id ? $this->code : ""; |
||
| 185 | } |
||
| 186 | |||
| 187 | /** |
||
| 188 | * Get id |
||
| 189 | * |
||
| 190 | * @return integer |
||
| 191 | */ |
||
| 192 | public function getId() |
||
| 193 | { |
||
| 194 | return $this->id; |
||
| 195 | } |
||
| 196 | |||
| 197 | /** |
||
| 198 | * Set code |
||
| 199 | * |
||
| 200 | * @param string $code |
||
| 201 | * |
||
| 202 | * @return Product |
||
| 203 | */ |
||
| 204 | public function setCode($code) |
||
| 205 | { |
||
| 206 | $this->code = $code; |
||
| 207 | |||
| 208 | return $this; |
||
| 209 | } |
||
| 210 | |||
| 211 | /** |
||
| 212 | * Get code |
||
| 213 | * |
||
| 214 | * @return string |
||
| 215 | */ |
||
| 216 | public function getCode() |
||
| 217 | { |
||
| 218 | return $this->code; |
||
| 219 | } |
||
| 220 | |||
| 221 | /** |
||
| 222 | * Set title |
||
| 223 | * |
||
| 224 | * @param string $title |
||
| 225 | * |
||
| 226 | * @return Product |
||
| 227 | */ |
||
| 228 | public function setTitle($title) |
||
| 229 | { |
||
| 230 | $this->title = $title; |
||
| 231 | |||
| 232 | return $this; |
||
| 233 | } |
||
| 234 | |||
| 235 | /** |
||
| 236 | * Get title |
||
| 237 | * |
||
| 238 | * @return string |
||
| 239 | */ |
||
| 240 | public function getTitle() |
||
| 241 | { |
||
| 242 | return $this->title; |
||
| 243 | } |
||
| 244 | |||
| 245 | /** |
||
| 246 | * Set description |
||
| 247 | * |
||
| 248 | * @param string $description |
||
| 249 | * |
||
| 250 | * @return Product |
||
| 251 | */ |
||
| 252 | public function setDescription($description) |
||
| 257 | } |
||
| 258 | |||
| 259 | /** |
||
| 260 | * Get description |
||
| 261 | * |
||
| 262 | * @return string |
||
| 263 | */ |
||
| 264 | public function getDescription() |
||
| 265 | { |
||
| 266 | return $this->description; |
||
| 267 | } |
||
| 268 | |||
| 269 | /** |
||
| 270 | * Set descriptionShort |
||
| 271 | * |
||
| 272 | * @param string $descriptionShort |
||
| 273 | * |
||
| 274 | * @return Product |
||
| 275 | */ |
||
| 276 | public function setDescriptionShort($descriptionShort) |
||
| 277 | { |
||
| 278 | $this->descriptionShort = $descriptionShort; |
||
| 279 | |||
| 280 | return $this; |
||
| 281 | } |
||
| 282 | |||
| 283 | /** |
||
| 284 | * Get descriptionShort |
||
| 285 | * |
||
| 286 | * @return string |
||
| 287 | */ |
||
| 288 | public function getDescriptionShort() |
||
| 289 | { |
||
| 290 | return $this->descriptionShort; |
||
| 291 | } |
||
| 292 | |||
| 293 | /** |
||
| 294 | * Set collection |
||
| 295 | * |
||
| 296 | * @param string $collection |
||
| 297 | * |
||
| 298 | * @return Product |
||
| 299 | */ |
||
| 300 | public function setCollection($collection) |
||
| 301 | { |
||
| 302 | $this->collection = $collection; |
||
| 303 | |||
| 304 | return $this; |
||
| 305 | } |
||
| 306 | |||
| 307 | /** |
||
| 308 | * Get collection |
||
| 309 | * |
||
| 310 | * @return string |
||
| 311 | */ |
||
| 312 | public function getCollection() |
||
| 313 | { |
||
| 314 | return $this->collection; |
||
| 315 | } |
||
| 316 | |||
| 317 | /** |
||
| 318 | * Set departurePlace |
||
| 319 | * |
||
| 320 | * @param string $departurePlace |
||
| 321 | * |
||
| 322 | * @return Product |
||
| 323 | */ |
||
| 324 | public function setDeparturePlace($departurePlace) |
||
| 325 | { |
||
| 326 | $this->departurePlace = $departurePlace; |
||
| 327 | |||
| 328 | return $this; |
||
| 329 | } |
||
| 330 | |||
| 331 | /** |
||
| 332 | * Get departurePlace |
||
| 333 | * |
||
| 334 | * @return string |
||
| 335 | */ |
||
| 336 | public function getDeparturePlace() |
||
| 337 | { |
||
| 338 | return $this->departurePlace; |
||
| 339 | } |
||
| 340 | |||
| 341 | /** |
||
| 342 | * Set departureTime |
||
| 343 | * |
||
| 344 | * @param \DateTime $departureTime |
||
| 345 | * |
||
| 346 | * @return Product |
||
| 347 | */ |
||
| 348 | public function setDepartureTime($departureTime) |
||
| 349 | { |
||
| 350 | $this->departureTime = $departureTime; |
||
| 351 | |||
| 352 | return $this; |
||
| 353 | } |
||
| 354 | |||
| 355 | /** |
||
| 356 | * Get departureTime |
||
| 357 | * |
||
| 358 | * @return \DateTime |
||
| 359 | */ |
||
| 360 | public function getDepartureTime() |
||
| 361 | { |
||
| 362 | return $this->departureTime; |
||
| 363 | } |
||
| 364 | |||
| 365 | /** |
||
| 366 | * Set returnPlace |
||
| 367 | * |
||
| 368 | * @param string $returnPlace |
||
| 369 | * |
||
| 370 | * @return Product |
||
| 371 | */ |
||
| 372 | public function setReturnPlace($returnPlace) |
||
| 373 | { |
||
| 374 | $this->returnPlace = $returnPlace; |
||
| 375 | |||
| 376 | return $this; |
||
| 377 | } |
||
| 378 | |||
| 379 | /** |
||
| 380 | * Get returnPlace |
||
| 381 | * |
||
| 382 | * @return string |
||
| 383 | */ |
||
| 384 | public function getReturnPlace() |
||
| 385 | { |
||
| 386 | return $this->returnPlace; |
||
| 387 | } |
||
| 388 | |||
| 389 | /** |
||
| 390 | * Set returnTime |
||
| 391 | * |
||
| 392 | * @param \DateTime $returnTime |
||
| 393 | * |
||
| 394 | * @return Product |
||
| 395 | */ |
||
| 396 | public function setReturnTime($returnTime) |
||
| 397 | { |
||
| 398 | $this->returnTime = $returnTime; |
||
| 399 | |||
| 400 | return $this; |
||
| 401 | } |
||
| 402 | |||
| 403 | /** |
||
| 404 | * Get returnTime |
||
| 405 | * |
||
| 406 | * @return \DateTime |
||
| 407 | */ |
||
| 408 | public function getReturnTime() |
||
| 409 | { |
||
| 410 | return $this->returnTime; |
||
| 411 | } |
||
| 412 | |||
| 413 | /** |
||
| 414 | * Set stateCode |
||
| 415 | * |
||
| 416 | * @param string $stateCode |
||
| 417 | * |
||
| 418 | * @return Product |
||
| 419 | */ |
||
| 420 | public function setStateCode($stateCode) |
||
| 421 | { |
||
| 422 | $this->stateCode = $stateCode; |
||
| 423 | |||
| 424 | return $this; |
||
| 425 | } |
||
| 426 | |||
| 427 | /** |
||
| 428 | * Get stateCode |
||
| 429 | * |
||
| 430 | * @return string |
||
| 431 | */ |
||
| 432 | public function getStateCode() |
||
| 433 | { |
||
| 434 | return $this->stateCode; |
||
| 435 | } |
||
| 436 | |||
| 437 | /** |
||
| 438 | * Set fullPrice |
||
| 439 | * |
||
| 440 | * @param string $fullPrice |
||
| 441 | * |
||
| 442 | * @return Product |
||
| 443 | */ |
||
| 444 | public function setFullPrice($fullPrice) |
||
| 445 | { |
||
| 446 | $this->fullPrice = $fullPrice; |
||
| 447 | |||
| 448 | return $this; |
||
| 449 | } |
||
| 450 | |||
| 451 | /** |
||
| 452 | * Get fullPrice |
||
| 453 | * |
||
| 454 | * @return string |
||
| 455 | */ |
||
| 456 | public function getFullPrice() |
||
| 457 | { |
||
| 458 | return $this->fullPrice; |
||
| 459 | } |
||
| 460 | |||
| 461 | /** |
||
| 462 | * Set web |
||
| 463 | * |
||
| 464 | * @param string $web |
||
| 465 | * |
||
| 466 | * @return Product |
||
| 467 | */ |
||
| 468 | public function setWeb($web) |
||
| 469 | { |
||
| 470 | $this->web = $web; |
||
| 471 | |||
| 472 | return $this; |
||
| 473 | } |
||
| 474 | |||
| 475 | /** |
||
| 476 | * Get web |
||
| 477 | * |
||
| 478 | * @return string |
||
| 479 | */ |
||
| 480 | public function getWeb() |
||
| 481 | { |
||
| 482 | return $this->web; |
||
| 483 | } |
||
| 484 | |||
| 485 | /** |
||
| 486 | * Set relaseTime |
||
| 487 | * |
||
| 488 | * @param \DateTime $relaseTime |
||
| 489 | * |
||
| 490 | * @return Product |
||
| 491 | */ |
||
| 492 | public function setRelaseTime($relaseTime) |
||
| 493 | { |
||
| 494 | $this->relaseTime = $relaseTime; |
||
| 495 | |||
| 496 | return $this; |
||
| 497 | } |
||
| 498 | |||
| 499 | /** |
||
| 500 | * Get relaseTime |
||
| 501 | * |
||
| 502 | * @return \DateTime |
||
| 503 | */ |
||
| 504 | public function getRelaseTime() |
||
| 505 | { |
||
| 506 | return $this->relaseTime; |
||
| 507 | } |
||
| 508 | |||
| 509 | /** |
||
| 510 | * Set highlights |
||
| 511 | * |
||
| 512 | * @param string $highlights |
||
| 513 | * |
||
| 514 | * @return Product |
||
| 515 | */ |
||
| 516 | public function setHighlights($highlights) |
||
| 517 | { |
||
| 518 | $this->highlights = $highlights; |
||
| 519 | |||
| 520 | return $this; |
||
| 521 | } |
||
| 522 | |||
| 523 | /** |
||
| 524 | * Get highlights |
||
| 525 | * |
||
| 526 | * @return string |
||
| 527 | */ |
||
| 528 | public function getHighlights() |
||
| 529 | { |
||
| 530 | return $this->highlights; |
||
| 531 | } |
||
| 532 | |||
| 533 | /** |
||
| 534 | * Set inclusion |
||
| 535 | * |
||
| 536 | * @param string $inclusion |
||
| 537 | * |
||
| 538 | * @return Product |
||
| 539 | */ |
||
| 540 | public function setInclusion($inclusion) |
||
| 541 | { |
||
| 542 | $this->inclusion = $inclusion; |
||
| 543 | |||
| 544 | return $this; |
||
| 545 | } |
||
| 546 | |||
| 547 | /** |
||
| 548 | * Get inclusion |
||
| 549 | * |
||
| 550 | * @return string |
||
| 551 | */ |
||
| 552 | public function getInclusion() |
||
| 553 | { |
||
| 554 | return $this->inclusion; |
||
| 555 | } |
||
| 556 | |||
| 557 | /** |
||
| 558 | * Set exclusion |
||
| 559 | * |
||
| 560 | * @param string $exclusion |
||
| 561 | * |
||
| 562 | * @return Product |
||
| 563 | */ |
||
| 564 | public function setExclusion($exclusion) |
||
| 565 | { |
||
| 566 | $this->exclusion = $exclusion; |
||
| 567 | |||
| 568 | return $this; |
||
| 569 | } |
||
| 570 | |||
| 571 | /** |
||
| 572 | * Get exclusion |
||
| 573 | * |
||
| 574 | * @return string |
||
| 575 | */ |
||
| 576 | public function getExclusion() |
||
| 577 | { |
||
| 578 | return $this->exclusion; |
||
| 579 | } |
||
| 580 | |||
| 581 | /** |
||
| 582 | * Set availableFrom |
||
| 583 | * |
||
| 584 | * @param \DateTime $availableFrom |
||
| 585 | * |
||
| 586 | * @return Product |
||
| 587 | */ |
||
| 588 | public function setAvailableFrom($availableFrom) |
||
| 589 | { |
||
| 590 | $this->availableFrom = $availableFrom; |
||
| 591 | |||
| 592 | return $this; |
||
| 593 | } |
||
| 594 | |||
| 595 | /** |
||
| 596 | * Get availableFrom |
||
| 597 | * |
||
| 598 | * @return \DateTime |
||
| 599 | */ |
||
| 600 | public function getAvailableFrom() |
||
| 601 | { |
||
| 602 | return $this->availableFrom; |
||
| 603 | } |
||
| 604 | |||
| 605 | /** |
||
| 606 | * Set availableTo |
||
| 607 | * |
||
| 608 | * @param \DateTime $availableTo |
||
| 609 | * |
||
| 610 | * @return Product |
||
| 611 | */ |
||
| 612 | public function setAvailableTo($availableTo) |
||
| 617 | } |
||
| 618 | |||
| 619 | /** |
||
| 620 | * Get availableTo |
||
| 621 | * |
||
| 622 | * @return \DateTime |
||
| 623 | */ |
||
| 624 | public function getAvailableTo() |
||
| 625 | { |
||
| 626 | return $this->availableTo; |
||
| 627 | } |
||
| 628 | |||
| 629 | /** |
||
| 630 | * Set info |
||
| 631 | * |
||
| 632 | * @param string $info |
||
| 633 | * |
||
| 634 | * @return Product |
||
| 635 | */ |
||
| 636 | public function setInfo($info) |
||
| 641 | } |
||
| 642 | |||
| 643 | /** |
||
| 644 | * Get info |
||
| 645 | * |
||
| 646 | * @return string |
||
| 647 | */ |
||
| 648 | public function getInfo() |
||
| 651 | } |
||
| 652 | |||
| 653 | /** |
||
| 654 | * Set voucher |
||
| 655 | * |
||
| 656 | * @param integer $voucher |
||
| 657 | * |
||
| 658 | * @return Product |
||
| 659 | */ |
||
| 660 | public function setVoucher($voucher) |
||
| 661 | { |
||
| 662 | $this->voucher = $voucher; |
||
| 663 | |||
| 664 | return $this; |
||
| 665 | } |
||
| 666 | |||
| 667 | /** |
||
| 668 | * Get voucher |
||
| 669 | * |
||
| 670 | * @return integer |
||
| 671 | */ |
||
| 672 | public function getVoucher() |
||
| 673 | { |
||
| 674 | return $this->voucher; |
||
| 675 | } |
||
| 676 | |||
| 677 | /** |
||
| 678 | * Set meetingPoint |
||
| 679 | * |
||
| 680 | * @param string $meetingPoint |
||
| 681 | * |
||
| 682 | * @return Product |
||
| 683 | */ |
||
| 684 | public function setMeetingPoint($meetingPoint) |
||
| 685 | { |
||
| 686 | $this->meetingPoint = $meetingPoint; |
||
| 687 | |||
| 688 | return $this; |
||
| 689 | } |
||
| 690 | |||
| 691 | /** |
||
| 692 | * Get meetingPoint |
||
| 693 | * |
||
| 694 | * @return string |
||
| 695 | */ |
||
| 696 | public function getMeetingPoint() |
||
| 697 | { |
||
| 698 | return $this->meetingPoint; |
||
| 699 | } |
||
| 700 | |||
| 701 | /** |
||
| 702 | * @return mixed |
||
| 703 | */ |
||
| 704 | public function getPrice() |
||
| 705 | { |
||
| 706 | return $this->getFullPrice(); |
||
| 707 | } |
||
| 708 | |||
| 709 | /** |
||
| 710 | * @return boolean |
||
| 711 | */ |
||
| 712 | public function getActive() |
||
| 713 | { |
||
| 714 | return $this->getAvailableFrom() < (new \DateTime()) && $this->getAvailableTo() > (new \DateTime()); |
||
| 715 | } |
||
| 716 | |||
| 717 | /** |
||
| 718 | * Permette di fare delle azioni al clonamento dell'entità |
||
| 719 | * |
||
| 720 | * @return mixed |
||
| 721 | */ |
||
| 722 | public function __clone() |
||
| 724 | // TODO: Implement __clone() method. |
||
| 725 | } |
||
| 726 | |||
| 727 | /** |
||
| 728 | * @return SkuskuSupplierInterface |
||
| 729 | */ |
||
| 730 | public function getSupplier() |
||
| 731 | { |
||
| 732 | return null; |
||
| 733 | } |
||
| 734 | } |
||
| 735 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths