We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 68 |
| Total Lines | 721 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
Complex classes like Document 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 Document, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 18 | class Document extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var \DateTime |
||
| 22 | */ |
||
| 23 | protected $crdate; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var \DateTime |
||
| 27 | */ |
||
| 28 | protected $tstamp; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var \Kitodo\Dlf\Common\Doc|null |
||
| 32 | */ |
||
| 33 | protected $doc = null; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var string |
||
| 37 | */ |
||
| 38 | protected $title; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @var string |
||
| 42 | */ |
||
| 43 | protected $prodId; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @var string |
||
| 47 | */ |
||
| 48 | protected $location; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @var string |
||
| 52 | */ |
||
| 53 | protected $recordId; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @var string |
||
| 57 | */ |
||
| 58 | protected $opacId; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @var string |
||
| 62 | */ |
||
| 63 | protected $unionId; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @var string |
||
| 67 | */ |
||
| 68 | protected $urn; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @var string |
||
| 72 | */ |
||
| 73 | protected $purl; |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @var string |
||
| 77 | */ |
||
| 78 | protected $titleSorting; |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @var string |
||
| 82 | */ |
||
| 83 | protected $author; |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @var string |
||
| 87 | */ |
||
| 88 | protected $year; |
||
| 89 | |||
| 90 | /** |
||
| 91 | * @var string |
||
| 92 | */ |
||
| 93 | protected $place; |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @var string |
||
| 97 | */ |
||
| 98 | protected $thumbnail; |
||
| 99 | |||
| 100 | /** |
||
| 101 | * @var int |
||
| 102 | */ |
||
| 103 | protected $structure; |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @var int |
||
| 107 | */ |
||
| 108 | protected $partof = 0; |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @var string |
||
| 112 | */ |
||
| 113 | protected $volume; |
||
| 114 | |||
| 115 | /** |
||
| 116 | * @var string |
||
| 117 | */ |
||
| 118 | protected $volumeSorting; |
||
| 119 | |||
| 120 | /** |
||
| 121 | * @var string |
||
| 122 | */ |
||
| 123 | protected $license; |
||
| 124 | |||
| 125 | /** |
||
| 126 | * @var string |
||
| 127 | */ |
||
| 128 | protected $terms; |
||
| 129 | |||
| 130 | /** |
||
| 131 | * @var string |
||
| 132 | */ |
||
| 133 | protected $restrictions; |
||
| 134 | |||
| 135 | /** |
||
| 136 | * @var string |
||
| 137 | */ |
||
| 138 | protected $outOfPrint; |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @var string |
||
| 142 | */ |
||
| 143 | protected $rightsInfo; |
||
| 144 | |||
| 145 | /** |
||
| 146 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> |
||
| 147 | * @Extbase\ORM\Lazy |
||
| 148 | */ |
||
| 149 | protected $collections = null; |
||
| 150 | |||
| 151 | /** |
||
| 152 | * @var string |
||
| 153 | */ |
||
| 154 | protected $metsLabel; |
||
| 155 | |||
| 156 | /** |
||
| 157 | * @var string |
||
| 158 | */ |
||
| 159 | protected $metsOrderlabel; |
||
| 160 | |||
| 161 | /** |
||
| 162 | * @var \Kitodo\Dlf\Domain\Model\Library |
||
| 163 | * @Extbase\ORM\Lazy |
||
| 164 | */ |
||
| 165 | protected $owner; |
||
| 166 | |||
| 167 | /** |
||
| 168 | * @var int |
||
| 169 | */ |
||
| 170 | protected $solrcore; |
||
| 171 | |||
| 172 | /** |
||
| 173 | * @var int |
||
| 174 | */ |
||
| 175 | protected $status; |
||
| 176 | |||
| 177 | /** |
||
| 178 | * @var string |
||
| 179 | */ |
||
| 180 | protected $documentFormat; |
||
| 181 | |||
| 182 | /** |
||
| 183 | * constructor |
||
| 184 | */ |
||
| 185 | public function __construct() |
||
| 186 | { |
||
| 187 | // Do not remove the next line: It would break the functionality |
||
| 188 | $this->initStorageObjects(); |
||
| 189 | } |
||
| 190 | |||
| 191 | protected function initStorageObjects() |
||
| 192 | { |
||
| 193 | $this->collections = new ObjectStorage(); |
||
| 194 | } |
||
| 195 | |||
| 196 | /** |
||
| 197 | * @return \Kitodo\Dlf\Common\Doc |
||
| 198 | */ |
||
| 199 | public function getDoc(): ?\Kitodo\Dlf\Common\Doc |
||
| 200 | { |
||
| 201 | return $this->doc; |
||
| 202 | } |
||
| 203 | |||
| 204 | /** |
||
| 205 | * @param \Kitodo\Dlf\Common\Doc $doc |
||
| 206 | */ |
||
| 207 | public function setDoc(\Kitodo\Dlf\Common\Doc $doc): void |
||
| 208 | { |
||
| 209 | $this->doc = $doc; |
||
| 210 | } |
||
| 211 | |||
| 212 | /** |
||
| 213 | * @return string |
||
| 214 | */ |
||
| 215 | public function getTitle(): string |
||
| 216 | { |
||
| 217 | return $this->title; |
||
| 218 | } |
||
| 219 | |||
| 220 | /** |
||
| 221 | * @param string $title |
||
| 222 | */ |
||
| 223 | public function setTitle(string $title): void |
||
| 224 | { |
||
| 225 | $this->title = $title; |
||
| 226 | } |
||
| 227 | |||
| 228 | /** |
||
| 229 | * @return string |
||
| 230 | */ |
||
| 231 | public function getProdId(): string |
||
| 232 | { |
||
| 233 | return $this->prodId; |
||
| 234 | } |
||
| 235 | |||
| 236 | /** |
||
| 237 | * @param string $prodId |
||
| 238 | */ |
||
| 239 | public function setProdId(string $prodId): void |
||
| 240 | { |
||
| 241 | $this->prodId = $prodId; |
||
| 242 | } |
||
| 243 | |||
| 244 | /** |
||
| 245 | * @return string |
||
| 246 | */ |
||
| 247 | public function getLocation(): string |
||
| 248 | { |
||
| 249 | return $this->location; |
||
| 250 | } |
||
| 251 | |||
| 252 | /** |
||
| 253 | * @param string $location |
||
| 254 | */ |
||
| 255 | public function setLocation(string $location): void |
||
| 256 | { |
||
| 257 | $this->location = $location; |
||
| 258 | } |
||
| 259 | |||
| 260 | /** |
||
| 261 | * @return string |
||
| 262 | */ |
||
| 263 | public function getRecordId(): string |
||
| 264 | { |
||
| 265 | return $this->recordId; |
||
| 266 | } |
||
| 267 | |||
| 268 | /** |
||
| 269 | * @param string $recordId |
||
| 270 | */ |
||
| 271 | public function setRecordId(string $recordId): void |
||
| 272 | { |
||
| 273 | $this->recordId = $recordId; |
||
| 274 | } |
||
| 275 | |||
| 276 | /** |
||
| 277 | * @return string |
||
| 278 | */ |
||
| 279 | public function getOpacId(): string |
||
| 280 | { |
||
| 281 | return $this->opacId; |
||
| 282 | } |
||
| 283 | |||
| 284 | /** |
||
| 285 | * @param string $opacId |
||
| 286 | */ |
||
| 287 | public function setOpacId(string $opacId): void |
||
| 288 | { |
||
| 289 | $this->opacId = $opacId; |
||
| 290 | } |
||
| 291 | |||
| 292 | /** |
||
| 293 | * @return string |
||
| 294 | */ |
||
| 295 | public function getUnionId(): string |
||
| 296 | { |
||
| 297 | return $this->unionId; |
||
| 298 | } |
||
| 299 | |||
| 300 | /** |
||
| 301 | * @param string $unionId |
||
| 302 | */ |
||
| 303 | public function setUnionId(string $unionId): void |
||
| 304 | { |
||
| 305 | $this->unionId = $unionId; |
||
| 306 | } |
||
| 307 | |||
| 308 | /** |
||
| 309 | * @return string |
||
| 310 | */ |
||
| 311 | public function getUrn(): string |
||
| 312 | { |
||
| 313 | return $this->urn; |
||
| 314 | } |
||
| 315 | |||
| 316 | /** |
||
| 317 | * @param string $urn |
||
| 318 | */ |
||
| 319 | public function setUrn(string $urn): void |
||
| 320 | { |
||
| 321 | $this->urn = $urn; |
||
| 322 | } |
||
| 323 | |||
| 324 | /** |
||
| 325 | * @return string |
||
| 326 | */ |
||
| 327 | public function getPurl(): string |
||
| 328 | { |
||
| 329 | return $this->purl; |
||
| 330 | } |
||
| 331 | |||
| 332 | /** |
||
| 333 | * @param string $purl |
||
| 334 | */ |
||
| 335 | public function setPurl(string $purl): void |
||
| 336 | { |
||
| 337 | $this->purl = $purl; |
||
| 338 | } |
||
| 339 | |||
| 340 | /** |
||
| 341 | * @return string |
||
| 342 | */ |
||
| 343 | public function getTitleSorting(): string |
||
| 344 | { |
||
| 345 | return $this->titleSorting; |
||
| 346 | } |
||
| 347 | |||
| 348 | /** |
||
| 349 | * @param string $titleSorting |
||
| 350 | */ |
||
| 351 | public function setTitleSorting(string $titleSorting): void |
||
| 352 | { |
||
| 353 | $this->titleSorting = $titleSorting; |
||
| 354 | } |
||
| 355 | |||
| 356 | /** |
||
| 357 | * @return string |
||
| 358 | */ |
||
| 359 | public function getAuthor(): string |
||
| 360 | { |
||
| 361 | return $this->author; |
||
| 362 | } |
||
| 363 | |||
| 364 | /** |
||
| 365 | * @param string $author |
||
| 366 | */ |
||
| 367 | public function setAuthor(string $author): void |
||
| 368 | { |
||
| 369 | $this->author = $author; |
||
| 370 | } |
||
| 371 | |||
| 372 | /** |
||
| 373 | * @return string |
||
| 374 | */ |
||
| 375 | public function getYear(): string |
||
| 376 | { |
||
| 377 | return $this->year; |
||
| 378 | } |
||
| 379 | |||
| 380 | /** |
||
| 381 | * @param string $year |
||
| 382 | */ |
||
| 383 | public function setYear(string $year): void |
||
| 384 | { |
||
| 385 | $this->year = $year; |
||
| 386 | } |
||
| 387 | |||
| 388 | /** |
||
| 389 | * @return string |
||
| 390 | */ |
||
| 391 | public function getPlace(): string |
||
| 392 | { |
||
| 393 | return $this->place; |
||
| 394 | } |
||
| 395 | |||
| 396 | /** |
||
| 397 | * @param string $place |
||
| 398 | */ |
||
| 399 | public function setPlace(string $place): void |
||
| 400 | { |
||
| 401 | $this->place = $place; |
||
| 402 | } |
||
| 403 | |||
| 404 | /** |
||
| 405 | * @return string |
||
| 406 | */ |
||
| 407 | public function getThumbnail(): string |
||
| 408 | { |
||
| 409 | return $this->thumbnail; |
||
| 410 | } |
||
| 411 | |||
| 412 | /** |
||
| 413 | * @param string $thumbnail |
||
| 414 | */ |
||
| 415 | public function setThumbnail(string $thumbnail): void |
||
| 416 | { |
||
| 417 | $this->thumbnail = $thumbnail; |
||
| 418 | } |
||
| 419 | |||
| 420 | /** |
||
| 421 | * @return int |
||
| 422 | */ |
||
| 423 | public function getStructure(): int |
||
| 424 | { |
||
| 425 | return $this->structure; |
||
| 426 | } |
||
| 427 | |||
| 428 | /** |
||
| 429 | * @param int $structure |
||
| 430 | */ |
||
| 431 | public function setStructure(int $structure): void |
||
| 432 | { |
||
| 433 | $this->structure = $structure; |
||
| 434 | } |
||
| 435 | |||
| 436 | /** |
||
| 437 | * @return int |
||
| 438 | */ |
||
| 439 | public function getPartof(): int |
||
| 440 | { |
||
| 441 | return $this->partof; |
||
| 442 | } |
||
| 443 | |||
| 444 | /** |
||
| 445 | * @param int $partof |
||
| 446 | */ |
||
| 447 | public function setPartof(int $partof): void |
||
| 448 | { |
||
| 449 | $this->partof = $partof; |
||
| 450 | } |
||
| 451 | |||
| 452 | /** |
||
| 453 | * @return string |
||
| 454 | */ |
||
| 455 | public function getVolume(): string |
||
| 456 | { |
||
| 457 | return $this->volume; |
||
| 458 | } |
||
| 459 | |||
| 460 | /** |
||
| 461 | * @param string $volume |
||
| 462 | */ |
||
| 463 | public function setVolume(string $volume): void |
||
| 464 | { |
||
| 465 | $this->volume = $volume; |
||
| 466 | } |
||
| 467 | |||
| 468 | /** |
||
| 469 | * @return string |
||
| 470 | */ |
||
| 471 | public function getVolumeSorting(): string |
||
| 472 | { |
||
| 473 | return $this->volumeSorting; |
||
| 474 | } |
||
| 475 | |||
| 476 | /** |
||
| 477 | * @param string $volumeSorting |
||
| 478 | */ |
||
| 479 | public function setVolumeSorting(string $volumeSorting): void |
||
| 480 | { |
||
| 481 | $this->volumeSorting = $volumeSorting; |
||
| 482 | } |
||
| 483 | |||
| 484 | /** |
||
| 485 | * @return string |
||
| 486 | */ |
||
| 487 | public function getLicense(): string |
||
| 488 | { |
||
| 489 | return $this->license; |
||
| 490 | } |
||
| 491 | |||
| 492 | /** |
||
| 493 | * @param string $license |
||
| 494 | */ |
||
| 495 | public function setLicense(string $license): void |
||
| 496 | { |
||
| 497 | $this->license = $license; |
||
| 498 | } |
||
| 499 | |||
| 500 | /** |
||
| 501 | * @return string |
||
| 502 | */ |
||
| 503 | public function getTerms(): string |
||
| 504 | { |
||
| 505 | return $this->terms; |
||
| 506 | } |
||
| 507 | |||
| 508 | /** |
||
| 509 | * @param string $terms |
||
| 510 | */ |
||
| 511 | public function setTerms(string $terms): void |
||
| 512 | { |
||
| 513 | $this->terms = $terms; |
||
| 514 | } |
||
| 515 | |||
| 516 | /** |
||
| 517 | * @return string |
||
| 518 | */ |
||
| 519 | public function getRestrictions(): string |
||
| 520 | { |
||
| 521 | return $this->restrictions; |
||
| 522 | } |
||
| 523 | |||
| 524 | /** |
||
| 525 | * @param string $restrictions |
||
| 526 | */ |
||
| 527 | public function setRestrictions(string $restrictions): void |
||
| 528 | { |
||
| 529 | $this->restrictions = $restrictions; |
||
| 530 | } |
||
| 531 | |||
| 532 | /** |
||
| 533 | * @return string |
||
| 534 | */ |
||
| 535 | public function getOutOfPrint(): string |
||
| 536 | { |
||
| 537 | return $this->outOfPrint; |
||
| 538 | } |
||
| 539 | |||
| 540 | /** |
||
| 541 | * @param string $outOfPrint |
||
| 542 | */ |
||
| 543 | public function setOutOfPrint(string $outOfPrint): void |
||
| 544 | { |
||
| 545 | $this->outOfPrint = $outOfPrint; |
||
| 546 | } |
||
| 547 | |||
| 548 | /** |
||
| 549 | * @return string |
||
| 550 | */ |
||
| 551 | public function getRightsInfo(): string |
||
| 552 | { |
||
| 553 | return $this->rightsInfo; |
||
| 554 | } |
||
| 555 | |||
| 556 | /** |
||
| 557 | * @param string $rightsInfo |
||
| 558 | */ |
||
| 559 | public function setRightsInfo(string $rightsInfo): void |
||
| 560 | { |
||
| 561 | $this->rightsInfo = $rightsInfo; |
||
| 562 | } |
||
| 563 | |||
| 564 | |||
| 565 | /** |
||
| 566 | * Returns the collections |
||
| 567 | * |
||
| 568 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> $collections |
||
| 569 | */ |
||
| 570 | public function getCollections() |
||
| 571 | { |
||
| 572 | return $this->collections; |
||
| 573 | } |
||
| 574 | |||
| 575 | /** |
||
| 576 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> $collections |
||
| 577 | */ |
||
| 578 | public function setCollections(?ObjectStorage $collections): void |
||
| 579 | { |
||
| 580 | $this->collections = $collections; |
||
| 581 | } |
||
| 582 | |||
| 583 | /** |
||
| 584 | * Adds a collection |
||
| 585 | * |
||
| 586 | * @param \Kitodo\Dlf\Domain\Model\Collection $collection |
||
| 587 | */ |
||
| 588 | public function addCollection(Collection $collection): void |
||
| 589 | { |
||
| 590 | $this->collections->attach($collection); |
||
| 591 | } |
||
| 592 | |||
| 593 | /** |
||
| 594 | * Removes a collection |
||
| 595 | * |
||
| 596 | * @param \Kitodo\Dlf\Domain\Model\Collection $collection |
||
| 597 | * |
||
| 598 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> collections |
||
| 599 | */ |
||
| 600 | public function removeCollection(Collection $collection) |
||
| 601 | { |
||
| 602 | $this->collections->detach($collection); |
||
| 603 | } |
||
| 604 | |||
| 605 | /** |
||
| 606 | * @return string |
||
| 607 | */ |
||
| 608 | public function getMetsLabel(): string |
||
| 609 | { |
||
| 610 | return $this->metsLabel; |
||
| 611 | } |
||
| 612 | |||
| 613 | /** |
||
| 614 | * @param string $metsLabel |
||
| 615 | */ |
||
| 616 | public function setMetsLabel(string $metsLabel): void |
||
| 617 | { |
||
| 618 | $this->metsLabel = $metsLabel; |
||
| 619 | } |
||
| 620 | |||
| 621 | /** |
||
| 622 | * @return string |
||
| 623 | */ |
||
| 624 | public function getMetsOrderlabel(): string |
||
| 625 | { |
||
| 626 | return $this->metsOrderlabel; |
||
| 627 | } |
||
| 628 | |||
| 629 | /** |
||
| 630 | * @param string $metsOrderlabel |
||
| 631 | */ |
||
| 632 | public function setMetsOrderlabel(string $metsOrderlabel): void |
||
| 633 | { |
||
| 634 | $this->metsOrderlabel = $metsOrderlabel; |
||
| 635 | } |
||
| 636 | |||
| 637 | /** |
||
| 638 | * @return \Kitodo\Dlf\Domain\Model\Library |
||
| 639 | */ |
||
| 640 | public function getOwner(): \Kitodo\Dlf\Domain\Model\Library |
||
| 641 | { |
||
| 642 | return $this->owner; |
||
| 643 | } |
||
| 644 | |||
| 645 | /** |
||
| 646 | * @param \Kitodo\Dlf\Domain\Model\Library $owner |
||
| 647 | */ |
||
| 648 | public function setOwner(\Kitodo\Dlf\Domain\Model\Library $owner): void |
||
| 649 | { |
||
| 650 | $this->owner = $owner; |
||
| 651 | } |
||
| 652 | |||
| 653 | /** |
||
| 654 | * @return int |
||
| 655 | */ |
||
| 656 | public function getSolrcore(): int |
||
| 657 | { |
||
| 658 | return $this->solrcore; |
||
| 659 | } |
||
| 660 | |||
| 661 | /** |
||
| 662 | * @param int $solrcore |
||
| 663 | */ |
||
| 664 | public function setSolrcore(int $solrcore): void |
||
| 665 | { |
||
| 666 | $this->solrcore = $solrcore; |
||
| 667 | } |
||
| 668 | |||
| 669 | /** |
||
| 670 | * @return int |
||
| 671 | */ |
||
| 672 | public function getStatus(): int |
||
| 673 | { |
||
| 674 | return $this->status; |
||
| 675 | } |
||
| 676 | |||
| 677 | /** |
||
| 678 | * @param int $status |
||
| 679 | */ |
||
| 680 | public function setStatus(int $status): void |
||
| 681 | { |
||
| 682 | $this->status = $status; |
||
| 683 | } |
||
| 684 | |||
| 685 | /** |
||
| 686 | * @return string |
||
| 687 | */ |
||
| 688 | public function getDocumentFormat(): string |
||
| 689 | { |
||
| 690 | return $this->documentFormat; |
||
| 691 | } |
||
| 692 | |||
| 693 | /** |
||
| 694 | * @param string $documentFormat |
||
| 695 | */ |
||
| 696 | public function setDocumentFormat(string $documentFormat): void |
||
| 697 | { |
||
| 698 | $this->documentFormat = $documentFormat; |
||
| 699 | } |
||
| 700 | |||
| 701 | /** |
||
| 702 | * Returns the timestamp |
||
| 703 | * |
||
| 704 | * @return \DateTime |
||
| 705 | */ |
||
| 706 | public function getTstamp(): \DateTime |
||
| 707 | { |
||
| 708 | return $this->tstamp; |
||
| 709 | } |
||
| 710 | |||
| 711 | /** |
||
| 712 | * Sets the timestamp |
||
| 713 | * |
||
| 714 | * @param \DateTime $tstamp |
||
| 715 | */ |
||
| 716 | public function setTstamp($tstamp): void |
||
| 719 | } |
||
| 720 | |||
| 721 | /** |
||
| 722 | * Returns the creation date |
||
| 723 | * |
||
| 724 | * @return \DateTime |
||
| 725 | */ |
||
| 726 | public function getCrdate(): \DateTime |
||
| 727 | { |
||
| 728 | return $this->crdate; |
||
| 729 | } |
||
| 730 | |||
| 731 | /** |
||
| 732 | * Sets the creation date |
||
| 733 | * |
||
| 734 | * @param \DateTime $crdate |
||
| 735 | */ |
||
| 736 | public function setCrdate($crdate): void |
||
| 737 | { |
||
| 738 | $this->crdate = $crdate; |
||
| 739 | } |
||
| 740 | |||
| 741 | } |
||
| 742 |