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