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