Passed
Pull Request — master (#123)
by Sebastian
03:12
created
Classes/Hooks/KitodoProductionHacks.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
                 }
58 58
                 $dmdIds = explode(' ', $id);
59 59
                 foreach ($dmdIds as $dmdId) {
60
-                    $recordIds = $xml->xpath('//mets:dmdSec[@ID="' . $dmdId . '"]//mods:mods/mods:recordInfo/mods:recordIdentifier');
60
+                    $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$dmdId.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier');
61 61
                     if (!empty($recordIds)) {
62 62
                         $record_id = (string) $recordIds[0];
63 63
                         break;
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
  * @subpackage dlf
21 21
  * @access public
22 22
  */
23
-class KitodoProductionHacks
24
-{
23
+class KitodoProductionHacks {
25 24
     /**
26 25
      * Hook for \Kitodo\Dlf\Common\MetsDocument::establishRecordId()
27 26
      * When using Kitodo.Production the record identifier is saved only in MODS, but not
@@ -34,8 +33,7 @@  discard block
 block discarded – undo
34 33
      *
35 34
      * @return void
36 35
      */
37
-    public function construct_postProcessRecordId(\SimpleXMLElement &$xml, &$record_id)
38
-    {
36
+    public function construct_postProcessRecordId(\SimpleXMLElement &$xml, &$record_id) {
39 37
         if (!$record_id) {
40 38
             $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
41 39
             // Get all logical structure nodes with metadata, but without associated METS-Pointers.
Please login to merge, or discard this patch.
Classes/Common/FulltextInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@
 block discarded – undo
21 21
  * @access public
22 22
  * @abstract
23 23
  */
24
-interface FulltextInterface
25
-{
24
+interface FulltextInterface {
26 25
     /**
27 26
      * This extracts raw fulltext data from XML
28 27
      *
Please login to merge, or discard this patch.
Classes/Common/MetadataInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@
 block discarded – undo
21 21
  * @access public
22 22
  * @abstract
23 23
  */
24
-interface MetadataInterface
25
-{
24
+interface MetadataInterface {
26 25
     /**
27 26
      * This extracts metadata from XML
28 27
      *
Please login to merge, or discard this patch.
Classes/Common/IiifUrlReader.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  */
28
-class IiifUrlReader implements UrlReaderInterface
29
-{
28
+class IiifUrlReader implements UrlReaderInterface {
30 29
     /**
31 30
      * Singleton instance of the class
32 31
      *
@@ -40,8 +39,7 @@  discard block
 block discarded – undo
40 39
      * {@inheritDoc}
41 40
      * @see \Ubl\Iiif\Tools\UrlReaderInterface::getContent()
42 41
      */
43
-    public function getContent($url)
44
-    {
42
+    public function getContent($url) {
45 43
         $fileContents = GeneralUtility::getUrl($url);
46 44
         if ($fileContents !== false) {
47 45
             return $fileContents;
@@ -57,8 +55,7 @@  discard block
 block discarded – undo
57 55
      *
58 56
      * @return IiifUrlReader
59 57
      */
60
-    public static function getInstance()
61
-    {
58
+    public static function getInstance() {
62 59
         if (!isset(self::$instance)) {
63 60
             self::$instance = new IiifUrlReader();
64 61
         }
Please login to merge, or discard this patch.
Classes/Common/KitodoFlashMessageRenderer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function getClass(FlashMessage $flashMessage): string
67 67
     {
68
-        return 'alert-' . self::$classes[$flashMessage->getSeverity()];
68
+        return 'alert-'.self::$classes[$flashMessage->getSeverity()];
69 69
     }
70 70
 
71 71
     /**
@@ -95,19 +95,19 @@  discard block
 block discarded – undo
95 95
         $markup[] = '<div class="typo3-messages">';
96 96
         foreach ($flashMessages as $flashMessage) {
97 97
             $messageTitle = $flashMessage->getTitle();
98
-            $markup[] = '<div class="alert ' . htmlspecialchars($this->getClass($flashMessage)) . '">';
98
+            $markup[] = '<div class="alert '.htmlspecialchars($this->getClass($flashMessage)).'">';
99 99
             $markup[] = '  <div class="media">';
100 100
             $markup[] = '    <div class="media-left">';
101 101
             $markup[] = '      <span class="fa-stack fa-lg">';
102 102
             $markup[] = '        <i class="fa fa-circle fa-stack-2x"></i>';
103
-            $markup[] = '        <i class="fa fa-' . htmlspecialchars($this->getIconName($flashMessage)) . ' fa-stack-1x"></i>';
103
+            $markup[] = '        <i class="fa fa-'.htmlspecialchars($this->getIconName($flashMessage)).' fa-stack-1x"></i>';
104 104
             $markup[] = '      </span>';
105 105
             $markup[] = '    </div>';
106 106
             $markup[] = '    <div class="media-body">';
107 107
             if ($messageTitle !== '') {
108
-                $markup[] = '      <h4 class="alert-title">' . htmlspecialchars($messageTitle) . '</h4>';
108
+                $markup[] = '      <h4 class="alert-title">'.htmlspecialchars($messageTitle).'</h4>';
109 109
             }
110
-            $markup[] = '      <p class="alert-message">' . $flashMessage->getMessage() . '</p>';
110
+            $markup[] = '      <p class="alert-message">'.$flashMessage->getMessage().'</p>';
111 111
             $markup[] = '    </div>';
112 112
             $markup[] = '  </div>';
113 113
             $markup[] = '</div>';
Please login to merge, or discard this patch.
Classes/ExpressionLanguage/DocumentTypeProvider.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,10 +23,8 @@
 block discarded – undo
23 23
  * @subpackage dlf
24 24
  * @access public
25 25
  */
26
-class DocumentTypeProvider extends AbstractProvider
27
-{
28
-    public function __construct()
29
-    {
26
+class DocumentTypeProvider extends AbstractProvider {
27
+    public function __construct() {
30 28
         $this->expressionLanguageProviders = [
31 29
             DocumentTypeFunctionProvider::class
32 30
         ];
Please login to merge, or discard this patch.
Classes/Hooks/Form/FieldInformation/SolrCoreStatus.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@
 block discarded – undo
24 24
  * @subpackage dlf
25 25
  * @access public
26 26
  */
27
-class SolrCoreStatus extends AbstractNode
28
-{
27
+class SolrCoreStatus extends AbstractNode {
29 28
     /**
30 29
      * Shows Solr core status for given 'index_name'
31 30
      *
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
                     $uptimeInSeconds = floor($response->getUptime() / 1000);
56 56
                     $dateTimeFrom = new \DateTime('@0');
57 57
                     $dateTimeTo = new \DateTime("@$uptimeInSeconds");
58
-                    $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a ' . Helper::getLanguageService()->getLL('flash.days') . ', %H:%I:%S');
58
+                    $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a '.Helper::getLanguageService()->getLL('flash.days').', %H:%I:%S');
59 59
                     $numDocuments = $response->getNumberOfDocuments();
60 60
                     $startTime = $response->getStartTime() ? strftime('%c', $response->getStartTime()->getTimestamp()) : 'N/A';
61 61
                     $lastModified = $response->getLastModified() ? strftime('%c', $response->getLastModified()->getTimestamp()) : 'N/A';
Please login to merge, or discard this patch.
Classes/Hooks/Form/FieldInformation/EditInProductionWarning.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
  * @subpackage dlf
24 24
  * @access public
25 25
  */
26
-class EditInProductionWarning extends AbstractNode
27
-{
26
+class EditInProductionWarning extends AbstractNode {
28 27
     /**
29 28
      * Generates warning message when editing 'index_name' field
30 29
      *
Please login to merge, or discard this patch.
Classes/Common/IiifManifest.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -694,16 +694,16 @@  discard block
 block discarded – undo
694 694
                     && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null)
695 695
                 ) {
696 696
                     if (is_string($values)) {
697
-                        $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)];
697
+                        $metadata[$resArray['index_name'].'_sorting'][0] = [trim((string) $values)];
698 698
                     } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) {
699 699
                         $metadata[$resArray['index_name']] = [];
700 700
                         foreach ($values->data() as $value) {
701
-                            $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $value);
701
+                            $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $value);
702 702
                         }
703 703
                     }
704 704
                 }
705
-                if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) {
706
-                    $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0];
705
+                if (empty($metadata[$resArray['index_name'].'_sorting'][0])) {
706
+                    $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0];
707 707
                 }
708 708
             }
709 709
         }
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
                     }
832 832
                 }
833 833
             } else {
834
-                $this->logger->warning('Invalid structure resource @id "' . $id . '"');
834
+                $this->logger->warning('Invalid structure resource @id "'.$id.'"');
835 835
                 return $rawText;
836 836
             }
837 837
             $this->rawTextArray[$id] = $rawText;
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
                 }
881 881
             }
882 882
         }
883
-        $this->logger->error('Could not load IIIF manifest from "' . $location . '"');
883
+        $this->logger->error('Could not load IIIF manifest from "'.$location.'"');
884 884
         return false;
885 885
     }
886 886
 
Please login to merge, or discard this patch.
Braces   +27 added lines, -54 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
  * @property-read string $thumbnail This holds the document's thumbnail location
57 57
  * @property-read string $toplevelId This holds the toplevel manifest's @id
58 58
  */
59
-final class IiifManifest extends Doc
60
-{
59
+final class IiifManifest extends Doc {
61 60
     /**
62 61
      * This holds the manifest file as string for serialization purposes
63 62
      * @see __sleep() / __wakeup()
@@ -118,8 +117,7 @@  discard block
 block discarded – undo
118 117
      * {@inheritDoc}
119 118
      * @see Doc::establishRecordId()
120 119
      */
121
-    protected function establishRecordId($pid)
122
-    {
120
+    protected function establishRecordId($pid) {
123 121
         if ($this->iiif !== null) {
124 122
             /*
125 123
              *  FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss
@@ -174,8 +172,7 @@  discard block
 block discarded – undo
174 172
      * {@inheritDoc}
175 173
      * @see Doc::getDocument()
176 174
      */
177
-    protected function getDocument()
178
-    {
175
+    protected function getDocument() {
179 176
         return $this->iiif;
180 177
     }
181 178
 
@@ -188,8 +185,7 @@  discard block
 block discarded – undo
188 185
      * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if
189 186
      * the resource is a Presentation API 2 / 3 resource
190 187
      */
191
-    public function getIiifVersion()
192
-    {
188
+    public function getIiifVersion() {
193 189
         if (!isset($this->iiifVersion)) {
194 190
             if ($this->iiif instanceof AbstractIiifResource1) {
195 191
                 $this->iiifVersion = 'IIIF1';
@@ -230,8 +226,7 @@  discard block
 block discarded – undo
230 226
      *
231 227
      * @return array|string
232 228
      */
233
-    protected function getUseGroups($use)
234
-    {
229
+    protected function getUseGroups($use) {
235 230
         if (!$this->useGrpsLoaded) {
236 231
             // Get configured USE attributes.
237 232
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -259,8 +254,7 @@  discard block
 block discarded – undo
259 254
      * {@inheritDoc}
260 255
      * @see Doc::_getPhysicalStructure()
261 256
      */
262
-    protected function _getPhysicalStructure()
263
-    {
257
+    protected function _getPhysicalStructure() {
264 258
         // Is there no physical structure array yet?
265 259
         if (!$this->physicalStructureLoaded) {
266 260
             if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) {
@@ -373,8 +367,7 @@  discard block
 block discarded – undo
373 367
      * {@inheritDoc}
374 368
      * @see Doc::getDownloadLocation()
375 369
      */
376
-    public function getDownloadLocation($id)
377
-    {
370
+    public function getDownloadLocation($id) {
378 371
         $fileLocation = $this->getFileLocation($id);
379 372
         $resource = $this->iiif->getContainedResourceById($fileLocation);
380 373
         if ($resource instanceof AbstractImageService) {
@@ -387,8 +380,7 @@  discard block
 block discarded – undo
387 380
      * {@inheritDoc}
388 381
      * @see Doc::getFileLocation()
389 382
      */
390
-    public function getFileLocation($id)
391
-    {
383
+    public function getFileLocation($id) {
392 384
         if ($id == null) {
393 385
             return null;
394 386
         }
@@ -412,8 +404,7 @@  discard block
 block discarded – undo
412 404
      * {@inheritDoc}
413 405
      * @see Doc::getFileMimeType()
414 406
      */
415
-    public function getFileMimeType($id)
416
-    {
407
+    public function getFileMimeType($id) {
417 408
         $fileResource = $this->iiif->getContainedResourceById($id);
418 409
         if ($fileResource instanceof CanvasInterface) {
419 410
             $format = "application/vnd.kitodo.iiif";
@@ -438,8 +429,7 @@  discard block
 block discarded – undo
438 429
      * {@inheritDoc}
439 430
      * @see Doc::getLogicalStructure()
440 431
      */
441
-    public function getLogicalStructure($id, $recursive = false)
442
-    {
432
+    public function getLogicalStructure($id, $recursive = false) {
443 433
         $details = [];
444 434
         if (!$recursive && !empty($this->logicalUnits[$id])) {
445 435
             return $this->logicalUnits[$id];
@@ -474,8 +464,7 @@  discard block
 block discarded – undo
474 464
      * @param array $processedStructures: IIIF resources that already have been processed
475 465
      * @return array Logical structure array
476 466
      */
477
-    protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = [])
478
-    {
467
+    protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) {
479 468
         $details = [];
480 469
         $details['id'] = $resource->getId();
481 470
         $details['dmdId'] = '';
@@ -567,8 +556,7 @@  discard block
 block discarded – undo
567 556
      *
568 557
      * @todo This method is still in experimental; the method signature may change.
569 558
      */
570
-    public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true)
571
-    {
559
+    public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) {
572 560
         if (!empty($this->originalMetadataArray[$id])) {
573 561
             return $this->originalMetadataArray[$id];
574 562
         }
@@ -610,8 +598,7 @@  discard block
 block discarded – undo
610 598
      * {@inheritDoc}
611 599
      * @see Doc::getMetadata()
612 600
      */
613
-    public function getMetadata($id, $cPid = 0)
614
-    {
601
+    public function getMetadata($id, $cPid = 0) {
615 602
         if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) {
616 603
             return $this->metadataArray[$id];
617 604
         }
@@ -718,8 +705,7 @@  discard block
 block discarded – undo
718 705
      * {@inheritDoc}
719 706
      * @see Doc::_getSmLinks()
720 707
      */
721
-    protected function _getSmLinks()
722
-    {
708
+    protected function _getSmLinks() {
723 709
         if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) {
724 710
             if (!empty($this->iiif->getDefaultCanvases())) {
725 711
                 foreach ($this->iiif->getDefaultCanvases() as $canvas) {
@@ -743,8 +729,7 @@  discard block
 block discarded – undo
743 729
      *
744 730
      * @param RangeInterface $range: Current range whose canvases shall be linked
745 731
      */
746
-    private function smLinkRangeCanvasesRecursively(RangeInterface $range)
747
-    {
732
+    private function smLinkRangeCanvasesRecursively(RangeInterface $range) {
748 733
         // map range's canvases including all child ranges' canvases
749 734
         if (!$range->isTopRange()) {
750 735
             foreach ($range->getAllCanvasesRecursively() as $canvas) {
@@ -767,8 +752,7 @@  discard block
 block discarded – undo
767 752
      * @param CanvasInterface $canvas
768 753
      * @param IiifResourceInterface $resource
769 754
      */
770
-    private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource)
771
-    {
755
+    private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) {
772 756
         $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId();
773 757
         if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) {
774 758
             $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId();
@@ -780,8 +764,7 @@  discard block
 block discarded – undo
780 764
      * @see Doc::getFullText()
781 765
      */
782 766
     //TODO: rewrite it to get full OCR
783
-    public function getFullText($id)
784
-    {
767
+    public function getFullText($id) {
785 768
         $rawText = '';
786 769
         // Get text from raw text array if available.
787 770
         if (!empty($this->rawTextArray[$id])) {
@@ -838,8 +821,7 @@  discard block
 block discarded – undo
838 821
      *
839 822
      * @return IiifResourceInterface
840 823
      */
841
-    public function getIiif()
842
-    {
824
+    public function getIiif() {
843 825
         return $this->iiif;
844 826
     }
845 827
 
@@ -847,8 +829,7 @@  discard block
 block discarded – undo
847 829
      * {@inheritDoc}
848 830
      * @see Doc::init()
849 831
      */
850
-    protected function init($location)
851
-    {
832
+    protected function init($location) {
852 833
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
853 834
     }
854 835
 
@@ -856,8 +837,7 @@  discard block
 block discarded – undo
856 837
      * {@inheritDoc}
857 838
      * @see Doc::loadLocation()
858 839
      */
859
-    protected function loadLocation($location)
860
-    {
840
+    protected function loadLocation($location) {
861 841
         $fileResource = GeneralUtility::getUrl($location);
862 842
         if ($fileResource !== false) {
863 843
             $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -880,8 +860,7 @@  discard block
 block discarded – undo
880 860
      * {@inheritDoc}
881 861
      * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray()
882 862
      */
883
-    protected function prepareMetadataArray($cPid)
884
-    {
863
+    protected function prepareMetadataArray($cPid) {
885 864
         $id = $this->iiif->getId();
886 865
         $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid);
887 866
     }
@@ -890,8 +869,7 @@  discard block
 block discarded – undo
890 869
      * {@inheritDoc}
891 870
      * @see Doc::setPreloadedDocument()
892 871
      */
893
-    protected function setPreloadedDocument($preloadedDocument)
894
-    {
872
+    protected function setPreloadedDocument($preloadedDocument) {
895 873
         if ($preloadedDocument instanceof ManifestInterface) {
896 874
             $this->iiif = $preloadedDocument;
897 875
             return true;
@@ -903,8 +881,7 @@  discard block
 block discarded – undo
903 881
      * {@inheritDoc}
904 882
      * @see Docu::ensureHasFulltextIsSet()
905 883
      */
906
-    protected function ensureHasFulltextIsSet()
907
-    {
884
+    protected function ensureHasFulltextIsSet() {
908 885
         /*
909 886
          *  TODO Check annotations and annotation lists of canvas for ALTO documents.
910 887
          *  Example:
@@ -950,8 +927,7 @@  discard block
 block discarded – undo
950 927
      * {@inheritDoc}
951 928
      * @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
952 929
      */
953
-    protected function _getThumbnail($forceReload = false)
954
-    {
930
+    protected function _getThumbnail($forceReload = false) {
955 931
         return $this->iiif->getThumbnailUrl();
956 932
     }
957 933
 
@@ -959,8 +935,7 @@  discard block
 block discarded – undo
959 935
      * {@inheritDoc}
960 936
      * @see \Kitodo\Dlf\Common\Doc::_getToplevelId()
961 937
      */
962
-    protected function _getToplevelId()
963
-    {
938
+    protected function _getToplevelId() {
964 939
         if (empty($this->toplevelId)) {
965 940
             if (isset($this->iiif)) {
966 941
                 $this->toplevelId = $this->iiif->getId();
@@ -977,8 +952,7 @@  discard block
 block discarded – undo
977 952
      *
978 953
      * @return void
979 954
      */
980
-    public function __wakeup()
981
-    {
955
+    public function __wakeup() {
982 956
         $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
983 957
         IiifHelper::setUrlReader(IiifUrlReader::getInstance());
984 958
         IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']);
@@ -998,8 +972,7 @@  discard block
 block discarded – undo
998 972
      *
999 973
      * @return string[]
1000 974
      */
1001
-    public function __sleep()
1002
-    {
975
+    public function __sleep() {
1003 976
         // TODO implement serializiation in IIIF library
1004 977
         $jsonArray = $this->iiif->getOriginalJsonArray();
1005 978
         $this->asJson = json_encode($jsonArray);
Please login to merge, or discard this patch.