Passed
Pull Request — master (#209)
by
unknown
11:26
created
Classes/Domain/Model/Document.php 1 patch
Braces   +64 added lines, -128 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
 /**
22 22
  * Document
23 23
  */
24
-class Document extends AbstractEntity
25
-{
24
+class Document extends AbstractEntity {
26 25
     // xml data size ist limited to 64 KB
27 26
     const XML_DATA_SIZE_LIMIT = 64 * 1024;
28 27
 
@@ -213,8 +212,7 @@  discard block
 block discarded – undo
213 212
     /**
214 213
      * __construct
215 214
      */
216
-    public function __construct()
217
-    {
215
+    public function __construct() {
218 216
         //Do not remove the next line: It would break the functionality
219 217
         $this->initStorageObjects();
220 218
     }
@@ -224,8 +222,7 @@  discard block
 block discarded – undo
224 222
      *
225 223
      * @return void
226 224
      */
227
-    protected function initStorageObjects()
228
-    {
225
+    protected function initStorageObjects() {
229 226
         $this->file = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
230 227
         $this->initCreationDate();
231 228
     }
@@ -235,8 +232,7 @@  discard block
 block discarded – undo
235 232
      *
236 233
      * @return string $title
237 234
      */
238
-    public function getTitle()
239
-    {
235
+    public function getTitle() {
240 236
         return $this->title;
241 237
     }
242 238
 
@@ -246,8 +242,7 @@  discard block
 block discarded – undo
246 242
      * @param string $title
247 243
      * @return void
248 244
      */
249
-    public function setTitle($title)
250
-    {
245
+    public function setTitle($title) {
251 246
         $this->title = $title ?? '';
252 247
         //htmlspecialchars_decode($title,ENT_QUOTES);
253 248
     }
@@ -257,8 +252,7 @@  discard block
 block discarded – undo
257 252
      *
258 253
      * @return array $authors
259 254
      */
260
-    public function getAuthors()
261
-    {
255
+    public function getAuthors() {
262 256
         $authors = @unserialize($this->authors);
263 257
         if (is_array($authors)) {
264 258
             return $authors;
@@ -273,8 +267,7 @@  discard block
 block discarded – undo
273 267
      * @param array $authors
274 268
      * @return void
275 269
      */
276
-    public function setAuthors($authors)
277
-    {
270
+    public function setAuthors($authors) {
278 271
         $this->authors = serialize($authors);
279 272
     }
280 273
 
@@ -283,8 +276,7 @@  discard block
 block discarded – undo
283 276
      *
284 277
      * @return string $xmlData
285 278
      */
286
-    public function getXmlData()
287
-    {
279
+    public function getXmlData() {
288 280
         return $this->xmlData;
289 281
     }
290 282
 
@@ -294,8 +286,7 @@  discard block
 block discarded – undo
294 286
      * @param string $xmlData
295 287
      * @return void
296 288
      */
297
-    public function setXmlData($xmlData)
298
-    {
289
+    public function setXmlData($xmlData) {
299 290
         $this->xmlData = $xmlData;
300 291
     }
301 292
 
@@ -304,8 +295,7 @@  discard block
 block discarded – undo
304 295
      *
305 296
      * @return string $slubInfoData
306 297
      */
307
-    public function getSlubInfoData()
308
-    {
298
+    public function getSlubInfoData() {
309 299
         return $this->slubInfoData;
310 300
     }
311 301
 
@@ -314,8 +304,7 @@  discard block
 block discarded – undo
314 304
      *
315 305
      * @return string $slubInfoData
316 306
      */
317
-    public function setSlubInfoData($slubInfoData)
318
-    {
307
+    public function setSlubInfoData($slubInfoData) {
319 308
         $this->slubInfoData = $slubInfoData;
320 309
     }
321 310
 
@@ -324,8 +313,7 @@  discard block
 block discarded – undo
324 313
      *
325 314
      * @return \EWW\Dpf\Domain\Model\DocumentType $documentType
326 315
      */
327
-    public function getDocumentType()
328
-    {
316
+    public function getDocumentType() {
329 317
         return $this->documentType;
330 318
     }
331 319
 
@@ -335,8 +323,7 @@  discard block
 block discarded – undo
335 323
      * @param \EWW\Dpf\Domain\Model\DocumentType $documentType
336 324
      * @return void
337 325
      */
338
-    public function setDocumentType(\EWW\Dpf\Domain\Model\DocumentType $documentType)
339
-    {
326
+    public function setDocumentType(\EWW\Dpf\Domain\Model\DocumentType $documentType) {
340 327
         $this->documentType = $documentType;
341 328
     }
342 329
 
@@ -345,8 +332,7 @@  discard block
 block discarded – undo
345 332
      *
346 333
      * @return string
347 334
      */
348
-    public function getObjectIdentifier()
349
-    {
335
+    public function getObjectIdentifier() {
350 336
         return $this->objectIdentifier;
351 337
     }
352 338
 
@@ -356,8 +342,7 @@  discard block
 block discarded – undo
356 342
      * @param string $objectIdentifier
357 343
      * @return void
358 344
      */
359
-    public function setObjectIdentifier($objectIdentifier)
360
-    {
345
+    public function setObjectIdentifier($objectIdentifier) {
361 346
         // Due to uniqe key uc_object_identifier, which should ignore empty object identifiers.
362 347
         $this->objectIdentifier = empty($objectIdentifier)? null : $objectIdentifier;
363 348
     }
@@ -367,8 +352,7 @@  discard block
 block discarded – undo
367 352
      *
368 353
      * @return string
369 354
      */
370
-    public function getReservedObjectIdentifier()
371
-    {
355
+    public function getReservedObjectIdentifier() {
372 356
         return $this->reservedObjectIdentifier;
373 357
     }
374 358
 
@@ -378,8 +362,7 @@  discard block
 block discarded – undo
378 362
      * @param string $reservedObjectIdentifier
379 363
      * @return void
380 364
      */
381
-    public function setReservedObjectIdentifier($reservedObjectIdentifier)
382
-    {
365
+    public function setReservedObjectIdentifier($reservedObjectIdentifier) {
383 366
         $this->reservedObjectIdentifier = $reservedObjectIdentifier;
384 367
     }
385 368
 
@@ -388,8 +371,7 @@  discard block
 block discarded – undo
388 371
      *
389 372
      * @return string
390 373
      */
391
-    public function getTransferStatus()
392
-    {
374
+    public function getTransferStatus() {
393 375
         return $this->transferStatus;
394 376
     }
395 377
 
@@ -399,8 +381,7 @@  discard block
 block discarded – undo
399 381
      * @param string
400 382
      * @return void
401 383
      */
402
-    public function setTransferStatus($transferStatus)
403
-    {
384
+    public function setTransferStatus($transferStatus) {
404 385
         $this->transferStatus = $transferStatus;
405 386
     }
406 387
 
@@ -409,8 +390,7 @@  discard block
 block discarded – undo
409 390
      *
410 391
      * @return integer
411 392
      */
412
-    public function getTransferDate()
413
-    {
393
+    public function getTransferDate() {
414 394
         return $this->transferDate;
415 395
     }
416 396
 
@@ -420,8 +400,7 @@  discard block
 block discarded – undo
420 400
      * @param integer $transferDate
421 401
      * @return void
422 402
      */
423
-    public function setTransferDate($transferDate)
424
-    {
403
+    public function setTransferDate($transferDate) {
425 404
         $this->transferDate = $transferDate;
426 405
     }
427 406
 
@@ -430,8 +409,7 @@  discard block
 block discarded – undo
430 409
      *
431 410
      * @var integer
432 411
      */
433
-    public function getTransferErrorCode()
434
-    {
412
+    public function getTransferErrorCode() {
435 413
         return $this->transferErrorCode;
436 414
     }
437 415
 
@@ -441,8 +419,7 @@  discard block
 block discarded – undo
441 419
      * @param integer $transferErrorCode
442 420
      * @return void
443 421
      */
444
-    public function setTransferErrorCode($transferErrorCode)
445
-    {
422
+    public function setTransferErrorCode($transferErrorCode) {
446 423
         $this->transferErrorCode = $transferErrorCode;
447 424
     }
448 425
 
@@ -451,8 +428,7 @@  discard block
 block discarded – undo
451 428
      *
452 429
      * @var string
453 430
      */
454
-    public function getTransferResponse()
455
-    {
431
+    public function getTransferResponse() {
456 432
         return $this->transferResponse;
457 433
     }
458 434
 
@@ -462,8 +438,7 @@  discard block
 block discarded – undo
462 438
      * @param string $transferResponse
463 439
      * @return void
464 440
      */
465
-    public function setTransferResponse($transferResponse)
466
-    {
441
+    public function setTransferResponse($transferResponse) {
467 442
         $this->transferResponse = $transferResponse;
468 443
     }
469 444
 
@@ -472,8 +447,7 @@  discard block
 block discarded – undo
472 447
      *
473 448
      * @var integer
474 449
      */
475
-    public function getTransferHttpStatus()
476
-    {
450
+    public function getTransferHttpStatus() {
477 451
         return $this->transferHttpStatus;
478 452
     }
479 453
 
@@ -483,8 +457,7 @@  discard block
 block discarded – undo
483 457
      * @param integer $transferHttpStatus
484 458
      * @return void
485 459
      */
486
-    public function setTransferHttpStatus($transferHttpStatus)
487
-    {
460
+    public function setTransferHttpStatus($transferHttpStatus) {
488 461
         $this->transferHttpStatus = $transferHttpStatus;
489 462
     }
490 463
 
@@ -494,8 +467,7 @@  discard block
 block discarded – undo
494 467
      * @param \EWW\Dpf\Domain\Model\File $file
495 468
      * @return void
496 469
      */
497
-    public function addFile(\EWW\Dpf\Domain\Model\File $file)
498
-    {
470
+    public function addFile(\EWW\Dpf\Domain\Model\File $file) {
499 471
         $this->file->attach($file);
500 472
     }
501 473
 
@@ -505,8 +477,7 @@  discard block
 block discarded – undo
505 477
      * @param \EWW\Dpf\Domain\Model\File $fileToRemove The File to be removed
506 478
      * @return void
507 479
      */
508
-    public function removeFile(\EWW\Dpf\Domain\Model\File $fileToRemove)
509
-    {
480
+    public function removeFile(\EWW\Dpf\Domain\Model\File $fileToRemove) {
510 481
         $this->file->detach($fileToRemove);
511 482
     }
512 483
 
@@ -515,8 +486,7 @@  discard block
 block discarded – undo
515 486
      *
516 487
      * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EWW\Dpf\Domain\Model\File> $file
517 488
      */
518
-    public function getFile()
519
-    {
489
+    public function getFile() {
520 490
         return $this->file;
521 491
     }
522 492
 
@@ -526,8 +496,7 @@  discard block
 block discarded – undo
526 496
      * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EWW\Dpf\Domain\Model\File> $file
527 497
      * @return void
528 498
      */
529
-    public function setFile(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $file)
530
-    {
499
+    public function setFile(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $file) {
531 500
         $this->file = $file;
532 501
     }
533 502
 
@@ -536,8 +505,7 @@  discard block
 block discarded – undo
536 505
      *
537 506
      * @return array
538 507
      */
539
-    public function getFileData()
540
-    {
508
+    public function getFileData() {
541 509
 
542 510
         $fileId = new \EWW\Dpf\Services\Transfer\FileId($this);
543 511
 
@@ -587,8 +555,7 @@  discard block
 block discarded – undo
587 555
      *
588 556
      * @return array
589 557
      */
590
-    public function getCurrentFileData()
591
-    {
558
+    public function getCurrentFileData() {
592 559
 
593 560
         $fileId = new \EWW\Dpf\Services\Transfer\FileId($this);
594 561
 
@@ -636,8 +603,7 @@  discard block
 block discarded – undo
636 603
      *
637 604
      * @return boolean $changed
638 605
      */
639
-    public function getChanged()
640
-    {
606
+    public function getChanged() {
641 607
         return $this->changed;
642 608
     }
643 609
 
@@ -647,8 +613,7 @@  discard block
 block discarded – undo
647 613
      * @param boolean $changed
648 614
      * @return void
649 615
      */
650
-    public function setChanged($changed)
651
-    {
616
+    public function setChanged($changed) {
652 617
         $this->changed = boolval($changed);
653 618
     }
654 619
 
@@ -657,8 +622,7 @@  discard block
 block discarded – undo
657 622
      *
658 623
      * @return boolean $valid
659 624
      */
660
-    public function getValid()
661
-    {
625
+    public function getValid() {
662 626
         return $this->valid;
663 627
     }
664 628
 
@@ -668,8 +632,7 @@  discard block
 block discarded – undo
668 632
      * @param boolean $valid
669 633
      * @return void
670 634
      */
671
-    public function setValid($valid)
672
-    {
635
+    public function setValid($valid) {
673 636
         $this->valid = boolval($valid);
674 637
     }
675 638
 
@@ -678,8 +641,7 @@  discard block
 block discarded – undo
678 641
      *
679 642
      * @return string
680 643
      */
681
-    public function getDateIssued()
682
-    {
644
+    public function getDateIssued() {
683 645
         return empty($this->dateIssued) ? '' : $this->dateIssued;
684 646
     }
685 647
 
@@ -689,8 +651,7 @@  discard block
 block discarded – undo
689 651
      * @param string $dateIssued
690 652
      * @return void
691 653
      */
692
-    public function setDateIssued($dateIssued)
693
-    {
654
+    public function setDateIssued($dateIssued) {
694 655
         $this->dateIssued = empty($dateIssued) ? '' : $dateIssued;
695 656
     }
696 657
 
@@ -700,8 +661,7 @@  discard block
 block discarded – undo
700 661
      *
701 662
      * @return string
702 663
      */
703
-    public function getProcessNumber()
704
-    {
664
+    public function getProcessNumber() {
705 665
         return $this->processNumber;
706 666
     }
707 667
 
@@ -711,8 +671,7 @@  discard block
 block discarded – undo
711 671
      * @param string $processNumber
712 672
      * @return void
713 673
      */
714
-    public function setProcessNumber($processNumber)
715
-    {
674
+    public function setProcessNumber($processNumber) {
716 675
         $this->processNumber = trim($processNumber);
717 676
     }
718 677
 
@@ -721,8 +680,7 @@  discard block
 block discarded – undo
721 680
      *
722 681
      * @return string
723 682
      */
724
-    public function getSubmitterName()
725
-    {
683
+    public function getSubmitterName() {
726 684
         try {
727 685
             $internalFormat = new InternalFormat($this->getXmlData(), $this->getPid());
728 686
             return $internalFormat->getSubmitterName();
@@ -736,8 +694,7 @@  discard block
 block discarded – undo
736 694
      *
737 695
      * @return string
738 696
      */
739
-    public function getPrimaryUrn()
740
-    {
697
+    public function getPrimaryUrn() {
741 698
         $internalFormat = new InternalFormat($this->getXmlData(), $this->getPid());
742 699
         return $internalFormat->getPrimaryUrn();
743 700
     }
@@ -747,8 +704,7 @@  discard block
 block discarded – undo
747 704
      *
748 705
      * @return int
749 706
      */
750
-    public function getCreator()
751
-    {
707
+    public function getCreator() {
752 708
         return $this->creator? $this->creator : 0;
753 709
     }
754 710
 
@@ -758,24 +714,20 @@  discard block
 block discarded – undo
758 714
      * @param int $creator
759 715
      * @return void
760 716
      */
761
-    public function setCreator($creator)
762
-    {
717
+    public function setCreator($creator) {
763 718
         $this->creator = $creator;
764 719
     }
765 720
 
766
-    public function getState()
767
-    {
721
+    public function getState() {
768 722
         return $this->state;
769 723
     }
770 724
 
771
-    public function setState($state)
772
-    {
725
+    public function setState($state) {
773 726
         $this->stateChange = $this->state != $state;
774 727
         $this->state = $state;
775 728
     }
776 729
 
777
-    public function getRemoteState()
778
-    {
730
+    public function getRemoteState() {
779 731
         $state = explode(':', $this->state);
780 732
         if (is_array($state) && array_key_exists(1, $state)) {
781 733
             return $state[1];
@@ -813,8 +765,7 @@  discard block
 block discarded – undo
813 765
     /**
814 766
      * @return string
815 767
      */
816
-    public function getRemoteLastModDate()
817
-    {
768
+    public function getRemoteLastModDate() {
818 769
         return $this->remoteLastModDate;
819 770
     }
820 771
 
@@ -822,24 +773,21 @@  discard block
 block discarded – undo
822 773
      * @param string $remoteLastModDate
823 774
      * @return void
824 775
      */
825
-    public function setRemoteLastModDate($remoteLastModDate)
826
-    {
776
+    public function setRemoteLastModDate($remoteLastModDate) {
827 777
         $this->remoteLastModDate = $remoteLastModDate;
828 778
     }
829 779
 
830 780
     /**
831 781
      * @return integer
832 782
      */
833
-    public function getTstamp()
834
-    {
783
+    public function getTstamp() {
835 784
         return $this->tstamp;
836 785
     }
837 786
 
838 787
     /**
839 788
      * @return integer
840 789
      */
841
-    public function getPid()
842
-    {
790
+    public function getPid() {
843 791
         return $this->pid;
844 792
     }
845 793
 
@@ -854,8 +802,7 @@  discard block
 block discarded – undo
854 802
     /**
855 803
      * @param bool $suggestion
856 804
      */
857
-    public function setSuggestion(bool $suggestion)
858
-    {
805
+    public function setSuggestion(bool $suggestion) {
859 806
         $this->suggestion = boolval($suggestion);
860 807
     }
861 808
 
@@ -870,8 +817,7 @@  discard block
 block discarded – undo
870 817
     /**
871 818
      * @param string $linkedUid
872 819
      */
873
-    public function setLinkedUid(string $linkedUid)
874
-    {
820
+    public function setLinkedUid(string $linkedUid) {
875 821
         $this->linkedUid = $linkedUid;
876 822
     }
877 823
 
@@ -886,8 +832,7 @@  discard block
 block discarded – undo
886 832
     /**
887 833
      * @param string $comment
888 834
      */
889
-    public function setComment(string $comment)
890
-    {
835
+    public function setComment(string $comment) {
891 836
         $this->comment = $comment;
892 837
     }
893 838
 
@@ -924,8 +869,7 @@  discard block
 block discarded – undo
924 869
      *
925 870
      * @return string|int
926 871
      */
927
-    public function getDocumentIdentifier()
928
-    {
872
+    public function getDocumentIdentifier() {
929 873
         return $this->getObjectIdentifier()? $this->getObjectIdentifier() : $this->getUid();
930 874
     }
931 875
 
@@ -934,8 +878,7 @@  discard block
 block discarded – undo
934 878
      *
935 879
      * @return bool
936 880
      */
937
-    public function isWorkingCopy()
938
-    {
881
+    public function isWorkingCopy() {
939 882
         return $this->getObjectIdentifier() && !$this->isTemporary() && !$this->isSuggestion();
940 883
     }
941 884
 
@@ -945,8 +888,7 @@  discard block
 block discarded – undo
945 888
      *
946 889
      * @return bool
947 890
      */
948
-    public function isTemporaryCopy()
949
-    {
891
+    public function isTemporaryCopy() {
950 892
         return $this->getObjectIdentifier() && $this->isTemporary() && !$this->isSuggestion();
951 893
     }
952 894
 
@@ -956,8 +898,7 @@  discard block
 block discarded – undo
956 898
      *
957 899
      * @return string|null
958 900
      */
959
-    public function getPublicationYear()
960
-    {
901
+    public function getPublicationYear() {
961 902
         $internalFormat = new InternalFormat($this->getXmlData(), $this->getPid());
962 903
         $year =  $internalFormat->getPublishingYear();
963 904
         return $year? $year : "";
@@ -968,8 +909,7 @@  discard block
 block discarded – undo
968 909
      *
969 910
      * @return string|null
970 911
      */
971
-    public function getSourceDetails()
972
-    {
912
+    public function getSourceDetails() {
973 913
         $internalFormat = new InternalFormat($this->getXmlData(), $this->getPid());
974 914
         $data = $internalFormat->getSourceDetails();
975 915
         return $data;
@@ -986,8 +926,7 @@  discard block
 block discarded – undo
986 926
     /**
987 927
      * @param \DateTime|null $embargoDate
988 928
      */
989
-    public function setEmbargoDate(?\DateTime $embargoDate)
990
-    {
929
+    public function setEmbargoDate(?\DateTime $embargoDate) {
991 930
         $this->embargoDate = $embargoDate;
992 931
     }
993 932
 
@@ -1010,8 +949,7 @@  discard block
 block discarded – undo
1010 949
     /**
1011 950
      * @return array
1012 951
      */
1013
-    public function getPreviouslyAssignedFobIdentifiers()
1014
-    {
952
+    public function getPreviouslyAssignedFobIdentifiers() {
1015 953
         return array_diff(
1016 954
             $this->getAssignedFobIdentifiers(), $this->getNewlyAssignedFobIdentifiers()
1017 955
         );
@@ -1037,8 +975,7 @@  discard block
 block discarded – undo
1037 975
     /**
1038 976
      * @return mixed
1039 977
      */
1040
-    public function getDepositLicense()
1041
-    {
978
+    public function getDepositLicense() {
1042 979
         $internalFormat = new InternalFormat($this->getXmlData(), $this->getPid());
1043 980
         $data = $internalFormat->getDepositLicense();
1044 981
         return $data;
@@ -1081,8 +1018,7 @@  discard block
 block discarded – undo
1081 1018
     /**
1082 1019
      * @return bool
1083 1020
      */
1084
-    public function isClientChangeable()
1085
-    {
1021
+    public function isClientChangeable() {
1086 1022
         return (
1087 1023
             in_array(
1088 1024
                 $this->getState(),
Please login to merge, or discard this patch.
Classes/Controller/BackendAdminController.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
 /**
33 33
 * Backend module user/group action controller
34 34
 */
35
-class BackendAdminController extends ActionController
36
-{
35
+class BackendAdminController extends ActionController {
37 36
     /**
38 37
      * documentRepository
39 38
      *
@@ -95,8 +94,7 @@  discard block
 block discarded – undo
95 94
      * @param ViewInterface $view
96 95
      * @return void
97 96
      */
98
-    protected function initializeView(ViewInterface $view)
99
-    {
97
+    protected function initializeView(ViewInterface $view) {
100 98
         /** @var BackendTemplateView $view */
101 99
         parent::initializeView($view);
102 100
         if ($this->actionMethodName == 'indexAction'
@@ -114,8 +112,7 @@  discard block
 block discarded – undo
114 112
     /**
115 113
      * @param string $identifier
116 114
      */
117
-    public function searchDocumentAction(string $identifier = '')
118
-    {
115
+    public function searchDocumentAction(string $identifier = '') {
119 116
         $identifier = trim($identifier);
120 117
         $this->view->assign('identifier', $identifier);
121 118
 
@@ -153,8 +150,7 @@  discard block
 block discarded – undo
153 150
      * @param Document $document
154 151
      * @param string $identifier
155 152
      */
156
-    public function chooseNewClientAction(Document $document, string $identifier)
157
-    {
153
+    public function chooseNewClientAction(Document $document, string $identifier) {
158 154
         if ($document) {
159 155
             if ($document->isClientChangeable()) {
160 156
                 /** @var Client $currentClient */
@@ -207,8 +203,7 @@  discard block
 block discarded – undo
207 203
      * @param string $identifier
208 204
      * @param DocumentType $documentType
209 205
      */
210
-    public function changeClientAction(Document $document, Client $client, string $identifier, DocumentType $documentType = null)
211
-    {
206
+    public function changeClientAction(Document $document, Client $client, string $identifier, DocumentType $documentType = null) {
212 207
         if ($documentType instanceof DocumentType) {
213 208
             if ($document->isClientChangeable()) {
214 209
 
@@ -323,8 +318,7 @@  discard block
 block discarded – undo
323 318
         array $headerArguments,
324 319
         array $bodyArguments,
325 320
         bool $storeInSession = false
326
-    )
327
-    {
321
+    ) {
328 322
         $messageHeader = LocalizationUtility::translate(
329 323
             'LLL:EXT:dpf/Resources/Private/Language/locallang_mod.xlf:admin_module.'.$headerKey,
330 324
             'dpf',
Please login to merge, or discard this patch.
Classes/Helper/InternalFormat.php 1 patch
Braces   +43 added lines, -82 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
 use EWW\Dpf\Services\ParserGenerator;
19 19
 use TYPO3\CMS\Extbase\Object\ObjectManager;
20 20
 
21
-class InternalFormat
22
-{
21
+class InternalFormat {
23 22
     const rootNode = '//data/';
24 23
 
25 24
     /**
@@ -46,8 +45,7 @@  discard block
 block discarded – undo
46 45
      * @param string $xml
47 46
      * @param int $clientPid
48 47
      */
49
-    public function __construct(string $xml, $clientPid = 0)
50
-    {
48
+    public function __construct(string $xml, $clientPid = 0) {
51 49
         $this->clientPid = $clientPid;
52 50
 
53 51
         $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class);
@@ -60,8 +58,7 @@  discard block
 block discarded – undo
60 58
         $this->setXml($xml);
61 59
     }
62 60
 
63
-    public function setXml($xml)
64
-    {
61
+    public function setXml($xml) {
65 62
         if (empty($xml)) {
66 63
             $xml = "<data></data>";
67 64
         }
@@ -71,8 +68,7 @@  discard block
 block discarded – undo
71 68
         $this->xml = $dom;
72 69
     }
73 70
 
74
-    public function getXml()
75
-    {
71
+    public function getXml() {
76 72
         return $this->xml->saveXML();
77 73
     }
78 74
 
@@ -80,37 +76,31 @@  discard block
 block discarded – undo
80 76
         return $this->xml;
81 77
     }
82 78
 
83
-    public function getXpath()
84
-    {
79
+    public function getXpath() {
85 80
         return $domXPath = \EWW\Dpf\Helper\XPath::create($this->xml);
86 81
     }
87 82
 
88
-    public function getDocumentType()
89
-    {
83
+    public function getDocumentType() {
90 84
         $typeXpath = $this->clientConfigurationManager->getTypeXpath();
91 85
         return $this->getValue($typeXpath);
92 86
     }
93 87
 
94
-    public function setDocumentType($type)
95
-    {
88
+    public function setDocumentType($type) {
96 89
         $typeXpath = $this->clientConfigurationManager->getTypeXpath();
97 90
         $this->setValue($typeXpath, $type);
98 91
     }
99 92
 
100
-    public function getRepositoryState()
101
-    {
93
+    public function getRepositoryState() {
102 94
         $stateXpath = $this->clientConfigurationManager->getStateXpath();
103 95
         return $this->getValue($stateXpath);
104 96
     }
105 97
 
106
-    public function setRepositoryState($state)
107
-    {
98
+    public function setRepositoryState($state) {
108 99
         $stateXpath = $this->clientConfigurationManager->getStateXpath();
109 100
         $this->setValue($stateXpath,$state);
110 101
     }
111 102
 
112
-    public function getProcessNumber()
113
-    {
103
+    public function getProcessNumber() {
114 104
         $processNumberXpath = $this->clientConfigurationManager->getProcessNumberXpath();
115 105
         if ($processNumberXpath) {
116 106
             return $this->getValue($processNumberXpath);
@@ -119,14 +109,12 @@  discard block
 block discarded – undo
119 109
         }
120 110
     }
121 111
 
122
-    public function setProcessNumber($processNumber)
123
-    {
112
+    public function setProcessNumber($processNumber) {
124 113
         $processNumberXpath = $this->clientConfigurationManager->getProcessNumberXpath();
125 114
         $this->setValue($processNumberXpath, $processNumber);
126 115
     }
127 116
 
128
-    public function getTitle()
129
-    {
117
+    public function getTitle() {
130 118
         $titleXpath = $this->clientConfigurationManager->getTitleXpath();
131 119
         $xpath = $this->getXpath();
132 120
 
@@ -141,14 +129,12 @@  discard block
 block discarded – undo
141 129
     /**
142 130
      * @param string $title
143 131
      */
144
-    public function setTitle($title)
145
-    {
132
+    public function setTitle($title) {
146 133
         $titleXpath = $this->clientConfigurationManager->getTitleXpath();
147 134
         $this->setValue($titleXpath, $title);
148 135
     }
149 136
 
150
-    public function getFiles()
151
-    {
137
+    public function getFiles() {
152 138
         $xpath = $this->getXpath();
153 139
 
154 140
         $fileXpath = $this->clientConfigurationManager->getFileXpath();
@@ -178,8 +164,7 @@  discard block
 block discarded – undo
178 164
         return $this->getValue($dateXpath);
179 165
     }
180 166
 
181
-    public function removeDateIssued()
182
-    {
167
+    public function removeDateIssued() {
183 168
         $xpath = $this->getXpath();
184 169
         $dateXpath = $this->clientConfigurationManager->getDateXpath();
185 170
 
@@ -190,8 +175,7 @@  discard block
 block discarded – undo
190 175
 
191 176
     }
192 177
 
193
-    public function hasPrimaryUrn()
194
-    {
178
+    public function hasPrimaryUrn() {
195 179
         $xpath = $this->getXpath();
196 180
         $primaryUrnXpath = $this->clientConfigurationManager->getPrimaryUrnXpath();
197 181
 
@@ -203,8 +187,7 @@  discard block
 block discarded – undo
203 187
         }
204 188
     }
205 189
 
206
-    public function getPrimaryUrn()
207
-    {
190
+    public function getPrimaryUrn() {
208 191
         $xpath = $this->getXpath();
209 192
         $primaryUrnXpath = $this->clientConfigurationManager->getPrimaryUrnXpath();
210 193
 
@@ -216,14 +199,12 @@  discard block
 block discarded – undo
216 199
         }
217 200
     }
218 201
 
219
-    public function setPrimaryUrn($urn)
220
-    {
202
+    public function setPrimaryUrn($urn) {
221 203
         $primaryUrnXpath = $this->clientConfigurationManager->getPrimaryUrnXpath();
222 204
         $this->setValue($primaryUrnXpath, $urn);
223 205
     }
224 206
 
225
-    public function clearAllUrn()
226
-    {
207
+    public function clearAllUrn() {
227 208
         $xpath = $this->getXpath();
228 209
         $urnXpath = $this->clientConfigurationManager->getUrnXpath();
229 210
         $primaryUrnXpath = $this->clientConfigurationManager->getPrimaryUrnXpath();
@@ -278,50 +259,42 @@  discard block
 block discarded – undo
278 259
         }
279 260
     }
280 261
 
281
-    public function getCreator()
282
-    {
262
+    public function getCreator() {
283 263
         $creatorXpath = $this->clientConfigurationManager->getCreatorXpath();
284 264
         return $this->getValue($creatorXpath);
285 265
     }
286 266
 
287
-    public function setCreator($creator)
288
-    {
267
+    public function setCreator($creator) {
289 268
         $creatorXpath = $this->clientConfigurationManager->getCreatorXpath();
290 269
         $this->setValue($creatorXpath, $creator);
291 270
     }
292 271
 
293
-    public function getCreationDate()
294
-    {
272
+    public function getCreationDate() {
295 273
         $xpath = $this->clientConfigurationManager->getCreationDateXpath();
296 274
         return $this->getValue($xpath);
297 275
     }
298 276
 
299
-    public function setCreationDate($creationDate)
300
-    {
277
+    public function setCreationDate($creationDate) {
301 278
         $xpath = $this->clientConfigurationManager->getCreationDateXpath();
302 279
         $this->setValue($xpath, $creationDate);
303 280
     }
304 281
 
305
-    public function getRepositoryCreationDate()
306
-    {
282
+    public function getRepositoryCreationDate() {
307 283
         $xpath = $this->clientConfigurationManager->getRepositoryCreationDateXpath();
308 284
         return $this->getValue($xpath);
309 285
     }
310 286
 
311
-    public function getRepositoryLastModDate()
312
-    {
287
+    public function getRepositoryLastModDate() {
313 288
         $xpath = $this->clientConfigurationManager->getRepositoryLastModDateXpath();
314 289
         return $this->getValue($xpath);
315 290
     }
316 291
 
317
-    public function getPublishingYear()
318
-    {
292
+    public function getPublishingYear() {
319 293
         $publishingYearXpath = $this->clientConfigurationManager->getPublishingYearXpath();
320 294
         return $this->getValue($publishingYearXpath);
321 295
     }
322 296
 
323
-    public function getOriginalSourceTitle()
324
-    {
297
+    public function getOriginalSourceTitle() {
325 298
         $originalSourceTitleXpath = $this->clientConfigurationManager->getOriginalSourceTitleXpath();
326 299
         return $this->getValue($originalSourceTitleXpath);
327 300
     }
@@ -329,8 +302,7 @@  discard block
 block discarded – undo
329 302
     /**
330 303
      * @return string
331 304
      */
332
-    public function getSourceDetails()
333
-    {
305
+    public function getSourceDetails() {
334 306
         if (empty($sourceDetailsXpaths)) {
335 307
             return '';
336 308
         }
@@ -389,8 +361,7 @@  discard block
 block discarded – undo
389 361
     /**
390 362
      * @return string
391 363
      */
392
-    public function getDepositLicense()
393
-    {
364
+    public function getDepositLicense() {
394 365
         $depositLicenseXpath = $this->clientConfigurationManager->getDepositLicenseXpath();
395 366
         return $this->getValue($depositLicenseXpath);
396 367
     }
@@ -398,8 +369,7 @@  discard block
 block discarded – undo
398 369
     /**
399 370
      * @return array
400 371
      */
401
-    public function getNotes()
402
-    {
372
+    public function getNotes() {
403 373
         $notesXpath = $this->clientConfigurationManager->getAllNotesXpath();
404 374
 
405 375
         $xpath = $this->getXpath();
@@ -407,16 +377,14 @@  discard block
 block discarded – undo
407 377
 
408 378
         $notes = array();
409 379
 
410
-        for ($i=0; $i < $notesNodes->length; $i++)
411
-        {
380
+        for ($i=0; $i < $notesNodes->length; $i++) {
412 381
             $notes[] = $notesNodes->item($i)->nodeValue;
413 382
         }
414 383
 
415 384
         return $notes;
416 385
     }
417 386
 
418
-    public function addNote($noteContent)
419
-    {
387
+    public function addNote($noteContent) {
420 388
         $notesXpath = $this->clientConfigurationManager->getPrivateNotesXpath();
421 389
 
422 390
         $parserGenerator = new ParserGenerator($this->clientPid);
@@ -426,13 +394,11 @@  discard block
 block discarded – undo
426 394
         $this->xml->loadXML($parserGenerator->getXMLData());
427 395
     }
428 396
 
429
-    public function getAuthors()
430
-    {
397
+    public function getAuthors() {
431 398
         return $this->getPersons($this->clientConfigurationManager->getPersonAuthorRole());
432 399
     }
433 400
 
434
-    public function getPublishers()
435
-    {
401
+    public function getPublishers() {
436 402
         return $this->getPersons($this->clientConfigurationManager->getPersonPublisherRole());
437 403
     }
438 404
 
@@ -442,8 +408,7 @@  discard block
 block discarded – undo
442 408
      * @param string $role
443 409
      * @return array
444 410
      */
445
-    public function getPersons($role = '')
446
-    {
411
+    public function getPersons($role = '') {
447 412
         $personXpath = $this->clientConfigurationManager->getPersonXpath();
448 413
         $familyXpath = $this->clientConfigurationManager->getPersonFamilyXpath();
449 414
         $givenXpath = $this->clientConfigurationManager->getPersonGivenXpath();
@@ -516,8 +481,9 @@  discard block
 block discarded – undo
516 481
         if ($role) {
517 482
             $result = [];
518 483
             foreach ($persons as $person) {
519
-                if ($person['role'] == $role)
520
-                    $result[] = $person;
484
+                if ($person['role'] == $role) {
485
+                                    $result[] = $person;
486
+                }
521 487
             }
522 488
             return $result;
523 489
         } else {
@@ -528,8 +494,7 @@  discard block
 block discarded – undo
528 494
     /**
529 495
      * @return bool
530 496
      */
531
-    public function getValidation()
532
-    {
497
+    public function getValidation() {
533 498
         $validationXpath =  $this->clientConfigurationManager->getValidationXpath();
534 499
         $validation = $this->getValue($validationXpath);
535 500
         return (strtolower($validation) === 'true')? true : false;
@@ -538,8 +503,7 @@  discard block
 block discarded – undo
538 503
     /**
539 504
      * @param bool $validated
540 505
      */
541
-    public function setValidation($validated)
542
-    {
506
+    public function setValidation($validated) {
543 507
         $validationXpath =  $this->clientConfigurationManager->getValidationXpath();
544 508
         $this->setValue($validationXpath, ($validated? 'true' : 'false'));
545 509
     }
@@ -547,8 +511,7 @@  discard block
 block discarded – undo
547 511
     /**
548 512
      * @param string $fisId
549 513
      */
550
-    public function setFisId($fisId)
551
-    {
514
+    public function setFisId($fisId) {
552 515
         $fisIdXpath =  $this->clientConfigurationManager->getFisIdXpath();
553 516
         $this->setValue($fisIdXpath, $fisId);
554 517
     }
@@ -557,8 +520,7 @@  discard block
 block discarded – undo
557 520
      * @param string $xpathString
558 521
      * @return string
559 522
      */
560
-    protected function getValue($xpathString)
561
-    {
523
+    protected function getValue($xpathString) {
562 524
         $xpath = $this->getXpath();
563 525
         $nodeList = $xpath->query(self::rootNode . $xpathString);
564 526
         if ($nodeList->length > 0) {
@@ -571,8 +533,7 @@  discard block
 block discarded – undo
571 533
      * @param string $xpathString
572 534
      * @param string $value
573 535
      */
574
-    protected function setValue($xpathString, $value)
575
-    {
536
+    protected function setValue($xpathString, $value) {
576 537
         $xpath = $this->getXpath();
577 538
         $nodes = $xpath->query(self::rootNode . $xpathString);
578 539
         if ($nodes->length > 0) {
Please login to merge, or discard this patch.