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