Passed
Pull Request — master (#123)
by Sebastian
03:39
created
Classes/Domain/Repository/DocumentRepository.php 4 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -210,7 +210,6 @@
 block discarded – undo
210 210
      * Volumes are documents that are both
211 211
      *  a) "leaf" elements i.e. partof != 0
212 212
      *  b) "root" elements that are not referenced by other documents ("root" elements that have no descendants)
213
-
214 213
      * @param array $settings
215 214
      *
216 215
      * @return array
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
         $excludeOtherWhere = '';
358 358
         if ($settings['excludeOther']) {
359
-            $excludeOtherWhere = 'tx_dlf_documents.pid=' . intval($settings['storagePid']);
359
+            $excludeOtherWhere = 'tx_dlf_documents.pid='.intval($settings['storagePid']);
360 360
         }
361 361
         // Check if there are any metadata to suggest.
362 362
         $result = $queryBuilder
@@ -408,12 +408,12 @@  discard block
 block discarded – undo
408 408
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
409 409
             ->getConnectionForTable('tx_dlf_documents');
410 410
 
411
-        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' .
412
-            'FROM `tx_dlf_documents` ' .
413
-            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
414
-            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
415
-            'WHERE `tx_dlf_documents`.`record_id` = ? ' .
416
-            'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
411
+        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '.
412
+            'FROM `tx_dlf_documents` '.
413
+            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '.
414
+            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '.
415
+            'WHERE `tx_dlf_documents`.`record_id` = ? '.
416
+            'AND `tx_dlf_relations`.`ident`="docs_colls" '.
417 417
             $where;
418 418
 
419 419
         $values = [
@@ -443,13 +443,13 @@  discard block
 block discarded – undo
443 443
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
444 444
             ->getConnectionForTable('tx_dlf_documents');
445 445
 
446
-        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' .
447
-            'FROM `tx_dlf_documents` ' .
448
-            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
449
-            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
450
-            'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' .
451
-            'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
452
-            'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' .
446
+        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '.
447
+            'FROM `tx_dlf_documents` '.
448
+            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '.
449
+            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '.
450
+            'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '.
451
+            'AND `tx_dlf_relations`.`ident`="docs_colls" '.
452
+            'AND '.Helper::whereExpression('tx_dlf_collections').' '.
453 453
             'GROUP BY `tx_dlf_documents`.`uid` ';
454 454
 
455 455
         $values = [
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return \Kitodo\Dlf\Domain\Model\Document|null
50 50
      */
51
-    public function findOneByParameters($parameters)
52
-    {
51
+    public function findOneByParameters($parameters) {
53 52
         $doc = null;
54 53
         $document = null;
55 54
 
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
      *
94 93
      * @return \Kitodo\Dlf\Domain\Model\Document|null
95 94
      */
96
-    public function findOldestDocument()
97
-    {
95
+    public function findOldestDocument() {
98 96
         $query = $this->createQuery();
99 97
 
100 98
         $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]);
@@ -108,8 +106,7 @@  discard block
 block discarded – undo
108 106
      * @param  \Kitodo\Dlf\Domain\Model\Structure $structure
109 107
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
110 108
      */
111
-    public function getChildrenOfYearAnchor($partOf, $structure)
112
-    {
109
+    public function getChildrenOfYearAnchor($partOf, $structure) {
113 110
         $query = $this->createQuery();
114 111
 
115 112
         $query->matching($query->equals('structure', $structure));
@@ -130,8 +127,7 @@  discard block
 block discarded – undo
130 127
      *
131 128
      * @return \Kitodo\Dlf\Domain\Model\Document|null
132 129
      */
133
-    public function findOneByIdAndSettings($uid, $settings = [])
134
-    {
130
+    public function findOneByIdAndSettings($uid, $settings = []) {
135 131
         $settings = ['documentSets' => $uid];
136 132
 
137 133
         return $this->findDocumentsBySettings($settings)->getFirst();
@@ -144,8 +140,7 @@  discard block
 block discarded – undo
144 140
      *
145 141
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
146 142
      */
147
-    public function findDocumentsBySettings($settings = [])
148
-    {
143
+    public function findDocumentsBySettings($settings = []) {
149 144
         $query = $this->createQuery();
150 145
 
151 146
         $constraints = [];
@@ -175,8 +170,7 @@  discard block
 block discarded – undo
175 170
      *
176 171
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
177 172
      */
178
-    public function findAllByCollectionsLimited($collections, $limit = 50)
179
-    {
173
+    public function findAllByCollectionsLimited($collections, $limit = 50) {
180 174
         $query = $this->createQuery();
181 175
 
182 176
         // order by start_date -> start_time...
@@ -213,8 +207,7 @@  discard block
 block discarded – undo
213 207
      *
214 208
      * @return array
215 209
      */
216
-    public function getStatisticsForSelectedCollection($settings)
217
-    {
210
+    public function getStatisticsForSelectedCollection($settings) {
218 211
         if ($settings['collections']) {
219 212
             // Include only selected collections.
220 213
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
@@ -348,8 +341,7 @@  discard block
 block discarded – undo
348 341
      *
349 342
      * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
350 343
      */
351
-    public function getTableOfContentsFromDb($uid, $pid, $settings)
352
-    {
344
+    public function getTableOfContentsFromDb($uid, $pid, $settings) {
353 345
         // Build table of contents from database.
354 346
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
355 347
             ->getQueryBuilderForTable('tx_dlf_documents');
@@ -397,8 +389,7 @@  discard block
 block discarded – undo
397 389
      *
398 390
      * @return array The found document object
399 391
      */
400
-    public function getOaiRecord($settings, $parameters)
401
-    {
392
+    public function getOaiRecord($settings, $parameters) {
402 393
         $where = '';
403 394
 
404 395
         if (!$settings['show_userdefined']) {
@@ -438,8 +429,7 @@  discard block
 block discarded – undo
438 429
      *
439 430
      * @return array The found document objects
440 431
      */
441
-    public function getOaiDocumentList($settings, $documentsToProcess)
442
-    {
432
+    public function getOaiDocumentList($settings, $documentsToProcess) {
443 433
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
444 434
             ->getConnectionForTable('tx_dlf_documents');
445 435
 
@@ -474,8 +464,7 @@  discard block
 block discarded – undo
474 464
      *
475 465
      * @return array
476 466
      */
477
-    public function findAllByUids($uids, $checkPartof = false)
478
-    {
467
+    public function findAllByUids($uids, $checkPartof = false) {
479 468
         // get all documents from db we are talking about
480 469
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
481 470
         $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents');
@@ -524,8 +513,7 @@  discard block
 block discarded – undo
524 513
      *
525 514
      * @return array
526 515
      */
527
-    public function findChildrenOfEach(array $uids)
528
-    {
516
+    public function findChildrenOfEach(array $uids) {
529 517
         $allDocuments = $this->findAllByUids($uids, true);
530 518
 
531 519
         $result = [];
@@ -546,8 +534,7 @@  discard block
 block discarded – undo
546 534
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
547 535
      * @return array
548 536
      */
549
-    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null)
550
-    {
537
+    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) {
551 538
         // set settings global inside this repository
552 539
         // (may be necessary when SolrSearch calls back)
553 540
         $this->settings = $settings;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function findOneByParameters($parameters)
52 52
     {
53
-        $doc = null;
54
-        $document = null;
53
+        $doc = NULL;
54
+        $document = NULL;
55 55
 
56 56
         if (isset($parameters['id']) && MathUtility::canBeInterpretedAsInteger($parameters['id'])) {
57 57
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 
64 64
         } else if (isset($parameters['location']) && GeneralUtility::isValidUrl($parameters['location'])) {
65 65
 
66
-            $doc = Doc::getInstance($parameters['location'], [], true);
66
+            $doc = Doc::getInstance($parameters['location'], [], TRUE);
67 67
 
68 68
             if ($doc->recordId) {
69 69
                 $document = $this->findOneByRecordId($doc->recordId);
70 70
             }
71 71
 
72
-            if ($document === null) {
72
+            if ($document === NULL) {
73 73
                 // create new (dummy) Document object
74 74
                 $document = GeneralUtility::makeInstance(Document::class);
75 75
                 $document->setLocation($parameters['location']);
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 
78 78
         }
79 79
 
80
-        if ($document !== null && $doc === null) {
81
-            $doc = Doc::getInstance($document->getLocation(), [], true);
80
+        if ($document !== NULL && $doc === NULL) {
81
+            $doc = Doc::getInstance($document->getLocation(), [], TRUE);
82 82
         }
83 83
 
84
-        if ($doc !== null) {
84
+        if ($doc !== NULL) {
85 85
             $document->setDoc($doc);
86 86
         }
87 87
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         }
156 156
 
157 157
         if (isset($settings['excludeOther']) && (int) $settings['excludeOther'] === 0) {
158
-            $query->getQuerySettings()->setRespectStoragePage(false);
158
+            $query->getQuerySettings()->setRespectStoragePage(FALSE);
159 159
         }
160 160
 
161 161
         if (count($constraints)) {
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
      *
475 475
      * @return array
476 476
      */
477
-    public function findAllByUids($uids, $checkPartof = false)
477
+    public function findAllByUids($uids, $checkPartof = FALSE)
478 478
     {
479 479
         // get all documents from db we are talking about
480 480
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
      */
527 527
     public function findChildrenOfEach(array $uids)
528 528
     {
529
-        $allDocuments = $this->findAllByUids($uids, true);
529
+        $allDocuments = $this->findAllByUids($uids, TRUE);
530 530
 
531 531
         $result = [];
532 532
         foreach ($allDocuments as $doc) {
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
547 547
      * @return array
548 548
      */
549
-    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null)
549
+    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = NULL)
550 550
     {
551 551
         // set settings global inside this repository
552 552
         // (may be necessary when SolrSearch calls back)
Please login to merge, or discard this patch.
Classes/ViewHelpers/StdWrapViewHelper.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,12 +15,10 @@  discard block
 block discarded – undo
15 15
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
16 16
 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
17 17
 
18
-class StdWrapViewHelper extends AbstractViewHelper
19
-{
18
+class StdWrapViewHelper extends AbstractViewHelper {
20 19
     protected $escapeOutput = false;
21 20
 
22
-    public function initializeArguments()
23
-    {
21
+    public function initializeArguments() {
24 22
         parent::initializeArguments();
25 23
         $this->registerArgument('wrap', 'string', 'The wrap information', true);
26 24
         $this->registerArgument('data', 'array', 'Data for the content object', false);
@@ -31,8 +29,7 @@  discard block
 block discarded – undo
31 29
      *
32 30
      * @return string
33 31
      */
34
-    public function render()
35
-    {
32
+    public function render() {
36 33
         $wrap = $this->arguments['wrap'];
37 34
         $data = $this->arguments['data'] ?? [];
38 35
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@
 block discarded – undo
17 17
 
18 18
 class StdWrapViewHelper extends AbstractViewHelper
19 19
 {
20
-    protected $escapeOutput = false;
20
+    protected $escapeOutput = FALSE;
21 21
 
22 22
     public function initializeArguments()
23 23
     {
24 24
         parent::initializeArguments();
25
-        $this->registerArgument('wrap', 'string', 'The wrap information', true);
26
-        $this->registerArgument('data', 'array', 'Data for the content object', false);
25
+        $this->registerArgument('wrap', 'string', 'The wrap information', TRUE);
26
+        $this->registerArgument('data', 'array', 'Data for the content object', FALSE);
27 27
     }
28 28
 
29 29
     /**
Please login to merge, or discard this patch.
Tests/Functional/FunctionalTestCase.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration();
72 72
 
73 73
         if ($this->disableJsonWrappedResponse) {
74
-            $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) {
74
+            $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function($ext) {
75 75
                 return $ext !== 'Resources/Core/Functional/Extensions/json_response';
76 76
             });
77 77
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
85 85
 
86
-        $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/';
86
+        $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-'.$this->identifier.'/';
87 87
         $this->httpClient = new HttpClient([
88 88
             'base_uri' => $this->baseUrl,
89 89
             'http_errors' => false,
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 
128 128
     protected function addSiteConfig($identifier, $baseUrl)
129 129
     {
130
-        $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml');
130
+        $siteConfig = Yaml::parseFile(__DIR__.'/../Fixtures/siteconfig.yaml');
131 131
         $siteConfig['base'] = $baseUrl;
132 132
         $siteConfig['languages'][0]['base'] = $baseUrl;
133 133
 
134
-        $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier;
134
+        $siteConfigPath = $this->instancePath.'/typo3conf/sites/'.$identifier;
135 135
         @mkdir($siteConfigPath, 0775, true);
136
-        file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig));
136
+        file_put_contents($siteConfigPath.'/config.yaml', Yaml::dump($siteConfig));
137 137
     }
138 138
 
139 139
     protected function initializeRepository(string $className, int $storagePid)
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $jsonDocuments = json_decode(file_get_contents($path), true);
153 153
 
154 154
         $updateQuery = $solr->service->createUpdate();
155
-        $documents = array_map(function ($jsonDoc) use ($updateQuery) {
155
+        $documents = array_map(function($jsonDoc) use ($updateQuery) {
156 156
             $document = $updateQuery->createDocument();
157 157
             foreach ($jsonDoc as $key => $value) {
158 158
                 $document->setField($key, $value);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @var bool
51 51
      */
52
-    protected $disableJsonWrappedResponse = false;
52
+    protected $disableJsonWrappedResponse = FALSE;
53 53
 
54 54
     /** @var ObjectManager */
55 55
     protected $objectManager;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/';
87 87
         $this->httpClient = new HttpClient([
88 88
             'base_uri' => $this->baseUrl,
89
-            'http_errors' => false,
89
+            'http_errors' => FALSE,
90 90
         ]);
91 91
 
92 92
         $this->addSiteConfig('dlf-testing', $this->baseUrl);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $siteConfig['languages'][0]['base'] = $baseUrl;
133 133
 
134 134
         $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier;
135
-        @mkdir($siteConfigPath, 0775, true);
135
+        @mkdir($siteConfigPath, 0775, TRUE);
136 136
         file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig));
137 137
     }
138 138
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     protected function importSolrDocuments(Solr $solr, string $path)
151 151
     {
152
-        $jsonDocuments = json_decode(file_get_contents($path), true);
152
+        $jsonDocuments = json_decode(file_get_contents($path), TRUE);
153 153
 
154 154
         $updateQuery = $solr->service->createUpdate();
155 155
         $documents = array_map(function ($jsonDoc) use ($updateQuery) {
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected $httpClient;
69 69
 
70
-    public function __construct()
71
-    {
70
+    public function __construct() {
72 71
         parent::__construct();
73 72
 
74 73
         $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration();
@@ -95,8 +94,7 @@  discard block
 block discarded – undo
95 94
         $this->addSiteConfig('dlf-testing', $this->baseUrl);
96 95
     }
97 96
 
98
-    protected function getDlfConfiguration()
99
-    {
97
+    protected function getDlfConfiguration() {
100 98
         return [
101 99
             'fileGrpImages' => 'DEFAULT,MAX',
102 100
             'fileGrpThumbs' => 'THUMBS',
@@ -134,8 +132,7 @@  discard block
 block discarded – undo
134 132
         ];
135 133
     }
136 134
 
137
-    protected function addSiteConfig($identifier, $baseUrl)
138
-    {
135
+    protected function addSiteConfig($identifier, $baseUrl) {
139 136
         $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml');
140 137
         $siteConfig['base'] = $baseUrl;
141 138
         $siteConfig['languages'][0]['base'] = $baseUrl;
@@ -145,8 +142,7 @@  discard block
 block discarded – undo
145 142
         file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig));
146 143
     }
147 144
 
148
-    protected function initializeRepository(string $className, int $storagePid)
149
-    {
145
+    protected function initializeRepository(string $className, int $storagePid) {
150 146
         $repository = $this->objectManager->get($className);
151 147
 
152 148
         $querySettings = $this->objectManager->get(Typo3QuerySettings::class);
@@ -156,8 +152,7 @@  discard block
 block discarded – undo
156 152
         return $repository;
157 153
     }
158 154
 
159
-    protected function importSolrDocuments(Solr $solr, string $path)
160
-    {
155
+    protected function importSolrDocuments(Solr $solr, string $path) {
161 156
         $jsonDocuments = json_decode(file_get_contents($path), true);
162 157
 
163 158
         $updateQuery = $solr->service->createUpdate();
@@ -176,8 +171,7 @@  discard block
 block discarded – undo
176 171
         $solr->service->update($updateQuery);
177 172
     }
178 173
 
179
-    protected function initLanguageService(string $locale)
180
-    {
174
+    protected function initLanguageService(string $locale) {
181 175
         if (class_exists(\TYPO3\CMS\Core\Localization\LanguageServiceFactory::class)) {
182 176
             $GLOBALS['LANG'] = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageServiceFactory::class)->create($locale);
183 177
         } else {
@@ -193,8 +187,7 @@  discard block
 block discarded – undo
193 187
     /**
194 188
      * Assert that $sub is recursively contained within $super.
195 189
      */
196
-    protected function assertArrayMatches(array $sub, array $super, string $message = '')
197
-    {
190
+    protected function assertArrayMatches(array $sub, array $super, string $message = '') {
198 191
         $this->assertEquals($sub, ArrayUtility::intersectRecursive($super, $sub), $message);
199 192
     }
200 193
 }
Please login to merge, or discard this patch.
Tests/Functional/Api/OaiPmhTest.php 3 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
     {
38 38
         parent::setUp();
39 39
 
40
-        $this->oaiUrl = $this->baseUrl . '/index.php?id=' . $this->oaiPage;
41
-        $this->oaiUrlNoStoragePid = $this->baseUrl . '/index.php?id=' . $this->oaiPageNoStoragePid;
40
+        $this->oaiUrl = $this->baseUrl.'/index.php?id='.$this->oaiPage;
41
+        $this->oaiUrlNoStoragePid = $this->baseUrl.'/index.php?id='.$this->oaiPageNoStoragePid;
42 42
 
43
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.xml');
44
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/metadata.xml');
45
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
46
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/pages.xml');
47
-        $this->importDataSet(__DIR__ . '/../../Fixtures/OaiPmh/pages.xml');
48
-        $this->importDataSet(__DIR__ . '/../../Fixtures/OaiPmh/solrcores.xml');
43
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/documents_1.xml');
44
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/metadata.xml');
45
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml');
46
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/pages.xml');
47
+        $this->importDataSet(__DIR__.'/../../Fixtures/OaiPmh/pages.xml');
48
+        $this->importDataSet(__DIR__.'/../../Fixtures/OaiPmh/solrcores.xml');
49 49
 
50 50
         $this->persistenceManager = $this->objectManager->get(PersistenceManager::class);
51 51
         $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, 20000);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             $coreName = Solr::createCore();
63 63
             $solr = Solr::getInstance($coreName);
64 64
 
65
-            $this->importSolrDocuments($solr, __DIR__ . '/../../Fixtures/Common/documents_1.solr.json');
65
+            $this->importSolrDocuments($solr, __DIR__.'/../../Fixtures/Common/documents_1.solr.json');
66 66
         }
67 67
 
68 68
         $oaiCoreModel = $this->solrCoreRepository->findByUid(11001);
Please login to merge, or discard this patch.
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
 use SimpleXMLElement;
13 13
 use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
14 14
 
15
-class OaiPmhTest extends FunctionalTestCase
16
-{
15
+class OaiPmhTest extends FunctionalTestCase {
17 16
     protected $disableJsonWrappedResponse = true;
18 17
 
19 18
     protected $coreExtensionsToLoad = [
@@ -53,8 +52,7 @@  discard block
 block discarded – undo
53 52
         $this->setUpOaiSolr();
54 53
     }
55 54
 
56
-    protected function setUpOaiSolr()
57
-    {
55
+    protected function setUpOaiSolr() {
58 56
         // Setup Solr only once for all tests in this suite
59 57
         static $solr = null;
60 58
 
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
     /**
75 73
      * @test
76 74
      */
77
-    public function correctlyRespondsOnBadVerb()
78
-    {
75
+    public function correctlyRespondsOnBadVerb() {
79 76
         $client = new HttpClient();
80 77
         $response = $client->get($this->baseUrl, [
81 78
             'query' => [
@@ -100,8 +97,7 @@  discard block
 block discarded – undo
100 97
     /**
101 98
      * @test
102 99
      */
103
-    public function canIdentify()
104
-    {
100
+    public function canIdentify() {
105 101
         $oai = Endpoint::build($this->oaiUrl);
106 102
         $identity = $oai->identify();
107 103
 
@@ -114,8 +110,7 @@  discard block
 block discarded – undo
114 110
     /**
115 111
      * @test
116 112
      */
117
-    public function identifyGivesFallbackDatestampWhenNoDocuments()
118
-    {
113
+    public function identifyGivesFallbackDatestampWhenNoDocuments() {
119 114
         $oai = Endpoint::build($this->oaiUrlNoStoragePid);
120 115
         $identity = $oai->identify();
121 116
 
@@ -125,8 +120,7 @@  discard block
 block discarded – undo
125 120
     /**
126 121
      * @test
127 122
      */
128
-    public function canListMetadataFormats()
129
-    {
123
+    public function canListMetadataFormats() {
130 124
         $oai = Endpoint::build($this->oaiUrl);
131 125
         $formats = $oai->listMetadataFormats();
132 126
 
@@ -141,8 +135,7 @@  discard block
 block discarded – undo
141 135
     /**
142 136
      * @test
143 137
      */
144
-    public function canListRecords()
145
-    {
138
+    public function canListRecords() {
146 139
         $oai = Endpoint::build($this->oaiUrl);
147 140
         $result = $oai->listRecords('mets');
148 141
 
@@ -155,8 +148,7 @@  discard block
 block discarded – undo
155 148
     /**
156 149
      * @test
157 150
      */
158
-    public function noRecordsUntil1900()
159
-    {
151
+    public function noRecordsUntil1900() {
160 152
         $this->expectException(OaipmhException::class);
161 153
         $this->expectExceptionMessage('empty list');
162 154
 
@@ -169,8 +161,7 @@  discard block
 block discarded – undo
169 161
     /**
170 162
      * @test
171 163
      */
172
-    public function canUseResumptionToken()
173
-    {
164
+    public function canUseResumptionToken() {
174 165
         // NOTE: cursor and expirationDate are optional by the specification,
175 166
         //       but we include them in our implementation
176 167
 
@@ -228,8 +219,7 @@  discard block
 block discarded – undo
228 219
     /**
229 220
      * @test
230 221
      */
231
-    public function noResumptionTokenForCompleteList()
232
-    {
222
+    public function noResumptionTokenForCompleteList() {
233 223
         $client = new HttpClient();
234 224
 
235 225
         foreach (['ListIdentifiers', 'ListRecords'] as $verb) {
@@ -251,8 +241,7 @@  discard block
 block discarded – undo
251 241
     /**
252 242
      * @test
253 243
      */
254
-    public function canListAndResumeIdentifiers()
255
-    {
244
+    public function canListAndResumeIdentifiers() {
256 245
         $oai = Endpoint::build($this->oaiUrl);
257 246
         $result = $oai->listIdentifiers('mets');
258 247
 
@@ -265,18 +254,15 @@  discard block
 block discarded – undo
265 254
         $this->assertEquals('oai:de:slub-dresden:db:id-476248086', $record->identifier);
266 255
     }
267 256
 
268
-    protected function parseUtc(string $dateTime)
269
-    {
257
+    protected function parseUtc(string $dateTime) {
270 258
         return DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $dateTime);
271 259
     }
272 260
 
273
-    protected function assertUtcDateString(string $dateTime)
274
-    {
261
+    protected function assertUtcDateString(string $dateTime) {
275 262
         $this->assertInstanceOf(DateTime::class, $this->parseUtc($dateTime));
276 263
     }
277 264
 
278
-    protected function assertInFuture(string $dateTime)
279
-    {
265
+    protected function assertInFuture(string $dateTime) {
280 266
         $this->assertGreaterThan(new DateTime(), $this->parseUtc($dateTime));
281 267
     }
282 268
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 class OaiPmhTest extends FunctionalTestCase
16 16
 {
17
-    protected $disableJsonWrappedResponse = true;
17
+    protected $disableJsonWrappedResponse = TRUE;
18 18
 
19 19
     protected $coreExtensionsToLoad = [
20 20
         'fluid',
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
     protected function setUpOaiSolr()
57 57
     {
58 58
         // Setup Solr only once for all tests in this suite
59
-        static $solr = null;
59
+        static $solr = NULL;
60 60
 
61
-        if ($solr === null) {
61
+        if ($solr === NULL) {
62 62
             $coreName = Solr::createCore();
63 63
             $solr = Solr::getInstance($coreName);
64 64
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         $this->expectExceptionMessage('empty list');
162 162
 
163 163
         $oai = Endpoint::build($this->oaiUrl);
164
-        $result = $oai->listRecords('mets', null, (new DateTime())->setDate(1900, 1, 1));
164
+        $result = $oai->listRecords('mets', NULL, (new DateTime())->setDate(1900, 1, 1));
165 165
 
166 166
         $result->current();
167 167
     }
Please login to merge, or discard this patch.
Tests/Functional/Common/SolrIndexingTest.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
         $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 20000);
44 44
         $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, 20000);
45 45
 
46
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.xml');
47
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
48
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/metadata.xml');
46
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/documents_1.xml');
47
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml');
48
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/metadata.xml');
49 49
     }
50 50
 
51 51
     /**
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $core = $this->createSolrCore();
114 114
 
115
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_fulltext.xml');
116
-        $this->importSolrDocuments($core->solr, __DIR__ . '/../../Fixtures/Common/documents_1.solr.json');
117
-        $this->importSolrDocuments($core->solr, __DIR__ . '/../../Fixtures/Common/documents_fulltext.solr.json');
115
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/documents_fulltext.xml');
116
+        $this->importSolrDocuments($core->solr, __DIR__.'/../../Fixtures/Common/documents_1.solr.json');
117
+        $this->importSolrDocuments($core->solr, __DIR__.'/../../Fixtures/Common/documents_fulltext.solr.json');
118 118
 
119 119
         $collections = $this->collectionRepository->findCollectionsBySettings([
120 120
             'index_name' => ['Musik', 'Projekt: Dresdner Hefte'],
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
 use TYPO3\CMS\Extbase\Object\ObjectManager;
17 17
 use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
18 18
 
19
-class SolrIndexingTest extends FunctionalTestCase
20
-{
19
+class SolrIndexingTest extends FunctionalTestCase {
21 20
     /** @var PersistenceManager */
22 21
     protected $persistenceManager;
23 22
 
@@ -51,8 +50,7 @@  discard block
 block discarded – undo
51 50
     /**
52 51
      * @test
53 52
      */
54
-    public function canCreateCore()
55
-    {
53
+    public function canCreateCore() {
56 54
         $coreName = uniqid('testCore');
57 55
         $solr = Solr::getInstance($coreName);
58 56
         $this->assertNull($solr->core);
@@ -67,8 +65,7 @@  discard block
 block discarded – undo
67 65
     /**
68 66
      * @test
69 67
      */
70
-    public function canIndexAndSearchDocument()
71
-    {
68
+    public function canIndexAndSearchDocument() {
72 69
         $core = $this->createSolrCore();
73 70
 
74 71
         $document = $this->documentRepository->findByUid(1001);
@@ -108,8 +105,7 @@  discard block
 block discarded – undo
108 105
     /**
109 106
      * @test
110 107
      */
111
-    public function canSearchInCollections()
112
-    {
108
+    public function canSearchInCollections() {
113 109
         $core = $this->createSolrCore();
114 110
 
115 111
         $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_fulltext.xml');
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,17 +86,17 @@
 block discarded – undo
86 86
             'storagePid' => $document->getPid(),
87 87
         ];
88 88
 
89
-        $solrSearch = $this->documentRepository->findSolrByCollection(null, $solrSettings, ['query' => '*']);
89
+        $solrSearch = $this->documentRepository->findSolrByCollection(NULL, $solrSettings, ['query' => '*']);
90 90
         $solrSearch->getQuery()->execute();
91 91
         $this->assertEquals(1, count($solrSearch));
92 92
         $this->assertEquals(15, $solrSearch->getNumFound());
93 93
 
94 94
         // Check that the title stored in Solr matches the title of database entry
95
-        $docTitleInSolr = false;
95
+        $docTitleInSolr = FALSE;
96 96
         foreach ($solrSearch->getSolrResults()['documents'] as $solrDoc) {
97 97
             if ($solrDoc['toplevel'] && $solrDoc['uid'] === $document->getUid()) {
98 98
                 $this->assertEquals($document->getTitle(), $solrDoc['title']);
99
-                $docTitleInSolr = true;
99
+                $docTitleInSolr = TRUE;
100 100
                 break;
101 101
             }
102 102
         }
Please login to merge, or discard this patch.
Classes/Controller/CalendarController.php 3 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@  discard block
 block discarded – undo
26 26
  * @subpackage dlf
27 27
  * @access public
28 28
  */
29
-class CalendarController extends AbstractController
30
-{
29
+class CalendarController extends AbstractController {
31 30
     /**
32 31
      * @var StructureRepository
33 32
      */
@@ -36,8 +35,7 @@  discard block
 block discarded – undo
36 35
     /**
37 36
      * @param StructureRepository $structureRepository
38 37
      */
39
-    public function injectStructureRepository(StructureRepository $structureRepository)
40
-    {
38
+    public function injectStructureRepository(StructureRepository $structureRepository) {
41 39
         $this->structureRepository = $structureRepository;
42 40
     }
43 41
 
@@ -54,8 +52,7 @@  discard block
 block discarded – undo
54 52
      *
55 53
      * @return void
56 54
      */
57
-    public function mainAction()
58
-    {
55
+    public function mainAction() {
59 56
         // Set initial document (anchor or year file) if configured.
60 57
         if (empty($this->requestData['id']) && !empty($this->settings['initialDocument'])) {
61 58
             $this->requestData['id'] = $this->settings['initialDocument'];
@@ -100,8 +97,7 @@  discard block
 block discarded – undo
100 97
      *
101 98
      * @return void
102 99
      */
103
-    public function calendarAction()
104
-    {
100
+    public function calendarAction() {
105 101
         // access arguments passed by the mainAction()
106 102
         $mainrequestData = $this->request->getArguments();
107 103
 
@@ -206,8 +202,7 @@  discard block
 block discarded – undo
206 202
      *
207 203
      * @return void
208 204
      */
209
-    public function yearsAction()
210
-    {
205
+    public function yearsAction() {
211 206
         // access arguments passed by the mainAction()
212 207
         $mainrequestData = $this->request->getArguments();
213 208
 
@@ -262,8 +257,7 @@  discard block
 block discarded – undo
262 257
      *
263 258
      * @return string Content for template subpart
264 259
      */
265
-    protected function getCalendarYear(&$calendarData, $calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12)
266
-    {
260
+    protected function getCalendarYear(&$calendarData, $calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12) {
267 261
         for ($i = $firstMonth; $i <= $lastMonth; $i++) {
268 262
             $key = $year . '-' . $i;
269 263
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 foreach ($year['children'] as $month) {
128 128
                     foreach ($month['children'] as $day) {
129 129
                         foreach ($day['children'] as $issue) {
130
-                            $title = $issue['label'] ?: $issue['orderlabel'];
130
+                            $title = $issue['label'] ? : $issue['orderlabel'];
131 131
                             if (strtotime($title) !== false) {
132 132
                                 $title = strftime('%x', strtotime($title));
133 133
                             }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                 $_day = date('j', $dateTimestamp);
172 172
                 $calendarIssuesByYear[$_year][$_month][$_day][] = $issue;
173 173
             } else {
174
-                $this->logger->warning('Document with UID ' . $issue['uid'] . 'has no valid date of publication');
174
+                $this->logger->warning('Document with UID '.$issue['uid'].'has no valid date of publication');
175 175
             }
176 176
         }
177 177
         // Sort by years.
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
         $this->view->assign('calendarData', $calendarData);
219 219
         $this->view->assign('documentId', $this->document->getUid());
220 220
         $this->view->assign('yearLinkTitle', $yearLinkTitle);
221
-        $this->view->assign('parentDocumentId', $this->document->getPartof() ?: $this->document->getDoc()->tableOfContents[0]['points']);
222
-        $this->view->assign('allYearDocTitle', $this->document->getDoc()->getTitle($this->document->getPartof()) ?: $this->document->getDoc()->tableOfContents[0]['label']);
221
+        $this->view->assign('parentDocumentId', $this->document->getPartof() ? : $this->document->getDoc()->tableOfContents[0]['points']);
222
+        $this->view->assign('allYearDocTitle', $this->document->getDoc()->getTitle($this->document->getPartof()) ? : $this->document->getDoc()->tableOfContents[0]['label']);
223 223
     }
224 224
 
225 225
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
                 if (empty($yearLabel)) {
257 257
                     // if neither order nor orderlabel is set, use the id...
258
-                    $yearLabel = (string)$id;
258
+                    $yearLabel = (string) $id;
259 259
                 }
260 260
 
261 261
                 $years[] = [
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     protected function getCalendarYear(&$calendarData, $calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12)
305 305
     {
306 306
         for ($i = $firstMonth; $i <= $lastMonth; $i++) {
307
-            $key = $year . '-' . $i;
307
+            $key = $year.'-'.$i;
308 308
 
309 309
             $calendarData[$key] = [
310 310
                 'DAYMON_NAME' => strftime('%a', strtotime('last Monday')),
@@ -314,16 +314,16 @@  discard block
 block discarded – undo
314 314
                 'DAYFRI_NAME' => strftime('%a', strtotime('last Friday')),
315 315
                 'DAYSAT_NAME' => strftime('%a', strtotime('last Saturday')),
316 316
                 'DAYSUN_NAME' => strftime('%a', strtotime('last Sunday')),
317
-                'MONTHNAME'  => strftime('%B', strtotime($year . '-' . $i . '-1')) . ' ' . $year,
317
+                'MONTHNAME'  => strftime('%B', strtotime($year.'-'.$i.'-1')).' '.$year,
318 318
                 'CALYEAR' => ($i == $firstMonth) ? $year : ''
319 319
             ];
320 320
 
321
-            $firstOfMonth = strtotime($year . '-' . $i . '-1');
321
+            $firstOfMonth = strtotime($year.'-'.$i.'-1');
322 322
             $lastOfMonth = strtotime('last day of', ($firstOfMonth));
323 323
             $firstOfMonthStart = strtotime('last Monday', $firstOfMonth);
324 324
             // There are never more than 6 weeks in a month.
325 325
             for ($j = 0; $j <= 5; $j++) {
326
-                $firstDayOfWeek = strtotime('+ ' . $j . ' Week', $firstOfMonthStart);
326
+                $firstDayOfWeek = strtotime('+ '.$j.' Week', $firstOfMonthStart);
327 327
 
328 328
                 $calendarData[$key]['week'][$j] = [
329 329
                     'DAYMON' => ['dayValue' => '&nbsp;'],
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
                 ];
337 337
                 // Every week has seven days. ;-)
338 338
                 for ($k = 0; $k <= 6; $k++) {
339
-                    $currentDayTime = strtotime('+ ' . $k . ' Day', $firstDayOfWeek);
339
+                    $currentDayTime = strtotime('+ '.$k.' Day', $firstDayOfWeek);
340 340
                     if (
341 341
                         $currentDayTime >= $firstOfMonth
342 342
                         && $currentDayTime <= $lastOfMonth
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                             }
368 368
                             $dayLinkDiv = $dayLinksText;
369 369
                         }
370
-                        switch (strftime('%w', strtotime('+ ' . $k . ' Day', $firstDayOfWeek))) {
370
+                        switch (strftime('%w', strtotime('+ '.$k.' Day', $firstDayOfWeek))) {
371 371
                             case '0':
372 372
                                 $calendarData[$key]['week'][$j]['DAYSUN']['dayValue'] = strftime('%d', $currentDayTime);
373 373
                                 if ((int) $dayLinks === (int) date('j', $currentDayTime)) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         // Load current document.
65 65
         $this->loadDocument($this->requestData);
66
-        if ($this->document === null) {
66
+        if ($this->document === NULL) {
67 67
             // Quit without doing anything if required variables are not set.
68 68
             return '';
69 69
         }
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
         switch ($type) {
79 79
             case 'newspaper':
80 80
             case 'ephemera':
81
-                $this->forward('years', null, null, $this->requestData);
81
+                $this->forward('years', NULL, NULL, $this->requestData);
82 82
                 break;
83 83
             case 'year':
84
-                $this->forward('calendar', null, null, $this->requestData);
84
+                $this->forward('calendar', NULL, NULL, $this->requestData);
85 85
                 break;
86 86
             case 'issue':
87 87
             default:
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         // Load current document.
112 112
         $this->loadDocument($this->requestData);
113
-        if ($this->document === null) {
113
+        if ($this->document === NULL) {
114 114
             // Quit without doing anything if required variables are not set.
115 115
             return '';
116 116
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                     foreach ($month['children'] as $day) {
129 129
                         foreach ($day['children'] as $issue) {
130 130
                             $title = $issue['label'] ?: $issue['orderlabel'];
131
-                            if (strtotime($title) !== false) {
131
+                            if (strtotime($title) !== FALSE) {
132 132
                                 $title = strftime('%x', strtotime($title));
133 133
                             }
134 134
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                     $title = $document->getTitle();
150 150
                 } else {
151 151
                     $title = !empty($document->getMetsLabel()) ? $document->getMetsLabel() : $document->getMetsOrderlabel();
152
-                    if (strtotime($title) !== false) {
152
+                    if (strtotime($title) !== FALSE) {
153 153
                         $title = strftime('%x', strtotime($title));
154 154
                     }
155 155
                 }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         $calendarIssuesByYear = [];
166 166
         foreach ($issues as $issue) {
167 167
             $dateTimestamp = strtotime($issue['year']);
168
-            if ($dateTimestamp !== false) {
168
+            if ($dateTimestamp !== FALSE) {
169 169
                 $_year = date('Y', $dateTimestamp);
170 170
                 $_month = date('n', $dateTimestamp);
171 171
                 $_day = date('j', $dateTimestamp);
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
         // Load current document.
241 241
         $this->loadDocument($this->requestData);
242
-        if ($this->document === null) {
242
+        if ($this->document === NULL) {
243 243
             // Quit without doing anything if required variables are not set.
244 244
             return '';
245 245
         }
Please login to merge, or discard this patch.
Classes/Controller/View3DController.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,13 +21,11 @@
 block discarded – undo
21 21
  * @subpackage dlf
22 22
  * @access public
23 23
  */
24
-class View3DController extends AbstractController
25
-{
24
+class View3DController extends AbstractController {
26 25
     /**
27 26
      * @return string|void
28 27
      */
29
-    public function mainAction()
30
-    {
28
+    public function mainAction() {
31 29
         $this->cObj = $this->configurationManager->getContentObject();
32 30
         // Load current document.
33 31
         $this->loadDocument($this->requestData);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@
 block discarded – undo
48 48
 
49 49
             $settingsParts = explode("/", $model);
50 50
             $fileName = end($settingsParts);
51
-            $path = substr($model, 0,  strrpos($model, $fileName));
52
-            $modelSettings = $path . "metadata/" . $fileName . "_viewer";
51
+            $path = substr($model, 0, strrpos($model, $fileName));
52
+            $modelSettings = $path."metadata/".$fileName."_viewer";
53 53
 
54 54
             if (!empty($modelConverted)) {
55 55
                 $model = $modelConverted;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
         // Load current document.
34 34
         $this->loadDocument($this->requestData);
35 35
         if (
36
-            $this->document === null
37
-            || $this->document->getDoc() === null
36
+            $this->document === NULL
37
+            || $this->document->getDoc() === NULL
38 38
             || $this->document->getDoc()->metadataArray['LOG_0001']['type'][0] != 'object'
39 39
         ) {
40 40
             // Quit without doing anything if required variables are not set.
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             }
57 57
 
58 58
             if ($this->settings['useInternalProxy']) {
59
-                $absoluteUri = !empty($this->settings['forceAbsoluteUrl']) ? true : false;
59
+                $absoluteUri = !empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE;
60 60
                 
61 61
                 $model = $this->uriBuilder->reset()
62 62
                     ->setTargetPageUid($GLOBALS['TSFE']->id)
Please login to merge, or discard this patch.
Classes/Format/AudioVideoMD.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,6 +48,6 @@
 block discarded – undo
48 48
             $metadata['video_duration'] = [$videoDuration];
49 49
         }
50 50
 
51
-        $metadata['duration'] = $metadata['video_duration'] ?: $metadata['audio_duration'] ?: [];
51
+        $metadata['duration'] = $metadata['video_duration'] ? : $metadata['audio_duration'] ? : [];
52 52
     }
53 53
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
      *
36 36
      * @return void
37 37
      */
38
-    public function extractMetadata(\SimpleXMLElement $xml, array &$metadata)
39
-    {
38
+    public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) {
40 39
         $xml->registerXPathNamespace('audiomd', 'http://www.loc.gov/audioMD/');
41 40
         $xml->registerXPathNamespace('videomd', 'http://www.loc.gov/videoMD/');
42 41
 
Please login to merge, or discard this patch.
Classes/Common/MetsDocument.php 3 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         $fileMimeType = $this->getFileMimeType($id);
218 218
         $fileLocation = $this->getFileLocation($id);
219 219
         if ($fileMimeType === 'application/vnd.kitodo.iiif') {
220
-            $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation . 'info.json' : $fileLocation . '/info.json');
220
+            $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation.'info.json' : $fileLocation.'/info.json');
221 221
             $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
222 222
             IiifHelper::setUrlReader(IiifUrlReader::getInstance());
223 223
             IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']);
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
                 return $service->getImageUrl();
228 228
             }
229 229
         } elseif ($fileMimeType === 'application/vnd.netfpx') {
230
-            $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : '');
230
+            $baseURL = $fileLocation.(strpos($fileLocation, '?') === false ? '?' : '');
231 231
             // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server'
232
-            return $baseURL . '&CVT=jpeg';
232
+            return $baseURL.'&CVT=jpeg';
233 233
         }
234 234
         return $fileLocation;
235 235
     }
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
      */
241 241
     public function getFileLocation($id)
242 242
     {
243
-        $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]');
243
+        $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]');
244 244
         if (
245 245
             !empty($id)
246 246
             && !empty($location)
247 247
         ) {
248 248
             return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href;
249 249
         } else {
250
-            $this->logger->warning('There is no file node with @ID "' . $id . '"');
250
+            $this->logger->warning('There is no file node with @ID "'.$id.'"');
251 251
             return '';
252 252
         }
253 253
     }
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function getFileMimeType($id)
260 260
     {
261
-        $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE');
261
+        $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE');
262 262
         if (
263 263
             !empty($id)
264 264
             && !empty($mimetype)
265 265
         ) {
266 266
             return (string) $mimetype[0];
267 267
         } else {
268
-            $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified');
268
+            $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified');
269 269
             return '';
270 270
         }
271 271
     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
             return $this->logicalUnits[$id];
287 287
         } elseif (!empty($id)) {
288 288
             // Get specified logical unit.
289
-            $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]');
289
+            $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]');
290 290
         } else {
291 291
             // Get all logical units at top level.
292 292
             $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div');
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
             // Retain current PID.
428 428
             $cPid = ($this->cPid ? $this->cPid : $this->pid);
429 429
         } elseif (!$cPid) {
430
-            $this->logger->warning('Invalid PID ' . $cPid . ' for metadata definitions');
430
+            $this->logger->warning('Invalid PID '.$cPid.' for metadata definitions');
431 431
             return [];
432 432
         }
433 433
         // Get metadata from parsed metadata array if available.
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
         if (!empty($this->logicalUnits[$id])) {
479 479
             $metadata['type'] = [$this->logicalUnits[$id]['type']];
480 480
         } else {
481
-            $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE');
481
+            $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE');
482 482
             if (!empty($struct)) {
483 483
                 $metadata['type'] = [(string) $struct[0]];
484 484
             }
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
                     ) {
504 504
                         $obj->extractMetadata($this->mdSec[$dmdId]['xml'], $metadata);
505 505
                     } else {
506
-                        $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"');
506
+                        $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"');
507 507
                     }
508 508
                 }
509 509
             } else {
510
-                $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"');
510
+                $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"');
511 511
                 // Continue searching for supported metadata with next @DMDID.
512 512
                 continue;
513 513
             }
@@ -623,13 +623,13 @@  discard block
 block discarded – undo
623 623
                             $values instanceof \DOMNodeList
624 624
                             && $values->length > 0
625 625
                         ) {
626
-                            $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue);
626
+                            $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue);
627 627
                         } elseif (!($values instanceof \DOMNodeList)) {
628
-                            $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values);
628
+                            $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values);
629 629
                         }
630 630
                     }
631
-                    if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) {
632
-                        $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0];
631
+                    if (empty($metadata[$resArray['index_name'].'_sorting'][0])) {
632
+                        $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0];
633 633
                     }
634 634
                 }
635 635
             }
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
         if (isset($this->fileInfos[$id]) || isset($hasMetadataSection['dmdSec'])) {
646 646
             return $metadata;
647 647
         } else {
648
-            $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"');
648
+            $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"');
649 649
             return [];
650 650
         }
651 651
     }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
             $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? '';
671 671
             $admIds = $this->logicalUnits[$id]['admId'] ?? '';
672 672
         } else {
673
-            $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0];
673
+            $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0];
674 674
             if ($mdSec) {
675 675
                 $dmdIds = (string) $mdSec->attributes()->DMDID;
676 676
                 $admIds = (string) $mdSec->attributes()->ADMID;
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
             }
699 699
         }
700 700
 
701
-        return array_filter($allMdIds, function ($element) {
701
+        return array_filter($allMdIds, function($element) {
702 702
             return !empty($element);
703 703
         });
704 704
     }
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
      */
726 726
     public function getStructureDepth($logId)
727 727
     {
728
-        $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
728
+        $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*');
729 729
         if (!empty($ancestors)) {
730 730
             return count($ancestors);
731 731
         } else {
@@ -749,9 +749,9 @@  discard block
 block discarded – undo
749 749
             $this->registerNamespaces($this->mets);
750 750
         } else {
751 751
             if (!empty($location)) {
752
-                $this->logger->error('No METS part found in document with location "' . $location . '".');
752
+                $this->logger->error('No METS part found in document with location "'.$location.'".');
753 753
             } else if (!empty($this->recordId)) {
754
-                $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".');
754
+                $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".');
755 755
             } else {
756 756
                 $this->logger->error('No METS part found in current document.');
757 757
             }
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
                 return true;
774 774
             }
775 775
         }
776
-        $this->logger->error('Could not load XML file from "' . $location . '"');
776
+        $this->logger->error('Could not load XML file from "'.$location.'"');
777 777
         return false;
778 778
     }
779 779
 
@@ -888,12 +888,12 @@  discard block
 block discarded – undo
888 888
         if ($type = $element->xpath('./mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) {
889 889
             if (!empty($this->formats[(string) $type[0]])) {
890 890
                 $type = (string) $type[0];
891
-                $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']);
891
+                $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
892 892
             }
893 893
         } elseif ($type = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) {
894 894
             if (!empty($this->formats[(string) $type[0]])) {
895 895
                 $type = (string) $type[0];
896
-                $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']);
896
+                $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
897 897
             }
898 898
         }
899 899
 
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
             // Retain current PID.
1101 1101
             $cPid = ($this->cPid ? $this->cPid : $this->pid);
1102 1102
             if (!$cPid) {
1103
-                $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions');
1103
+                $this->logger->error('Invalid PID '.$cPid.' for structure definitions');
1104 1104
                 $this->thumbnailLoaded = true;
1105 1105
                 return $this->thumbnail;
1106 1106
             }
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
                 if (!empty($resArray['thumbnail'])) {
1138 1138
                     $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid);
1139 1139
                     // Check if this document has a structure element of the desired type.
1140
-                    $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID');
1140
+                    $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID');
1141 1141
                     if (!empty($strctIds)) {
1142 1142
                         $strctId = (string) $strctIds[0];
1143 1143
                     }
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
                     }
1161 1161
                 }
1162 1162
             } else {
1163
-                $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database');
1163
+                $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database');
1164 1164
             }
1165 1165
             $this->thumbnailLoaded = true;
1166 1166
         }
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
             $this->parentHref = '';
1208 1208
 
1209 1209
             // Get the closest ancestor of the current document which has a MPTR child.
1210
-            $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
1210
+            $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
1211 1211
             if (!empty($parentMptr)) {
1212 1212
                 $this->parentHref = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href;
1213 1213
             }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * @var bool
96 96
      * @access protected
97 97
      */
98
-    protected $mdSecLoaded = false;
98
+    protected $mdSecLoaded = FALSE;
99 99
 
100 100
     /**
101 101
      * Subset of $mdSec storing only the dmdSec entries; kept for compatibility.
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @var bool
130 130
      * @access protected
131 131
      */
132
-    protected $fileGrpsLoaded = false;
132
+    protected $fileGrpsLoaded = FALSE;
133 133
 
134 134
     /**
135 135
      * Additional information about files (e.g., ADMID), indexed by ID.
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
             IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']);
224 224
             IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']);
225 225
             $service = IiifHelper::loadIiifResource($fileLocation);
226
-            if ($service !== null && $service instanceof AbstractImageService) {
226
+            if ($service !== NULL && $service instanceof AbstractImageService) {
227 227
                 return $service->getImageUrl();
228 228
             }
229 229
         } elseif ($fileMimeType === 'application/vnd.netfpx') {
230
-            $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : '');
230
+            $baseURL = $fileLocation . (strpos($fileLocation, '?') === FALSE ? '?' : '');
231 231
             // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server'
232 232
             return $baseURL . '&CVT=jpeg';
233 233
         }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      * {@inheritDoc}
275 275
      * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure()
276 276
      */
277
-    public function getLogicalStructure($id, $recursive = false)
277
+    public function getLogicalStructure($id, $recursive = FALSE)
278 278
     {
279 279
         $details = [];
280 280
         // Is the requested logical unit already loaded?
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      *
316 316
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
317 317
      */
318
-    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false)
318
+    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = FALSE)
319 319
     {
320 320
         // Get attributes.
321 321
         foreach ($structure->attributes() as $attribute => $value) {
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
             && array_key_exists($details['id'], $this->smLinks['l2p'])
362 362
         ) {
363 363
             // Link logical structure to the first corresponding physical page/track.
364
-            $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true)), 1);
364
+            $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1);
365 365
             $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']);
366 366
             while ($fileGrpThumb = array_shift($fileGrpsThumb)) {
367 367
                 if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$fileGrpThumb])) {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
             $details['children'] = [];
406 406
             foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) {
407 407
                 // Repeat for all children.
408
-                $details['children'][] = $this->getLogicalStructureInfo($child, true);
408
+                $details['children'][] = $this->getLogicalStructureInfo($child, TRUE);
409 409
             }
410 410
         }
411 411
         return $details;
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
                 }
635 635
             }
636 636
 
637
-            $hasMetadataSection[$mdSectionType] = true;
637
+            $hasMetadataSection[$mdSectionType] = TRUE;
638 638
         }
639 639
         // Set title to empty string if not present.
640 640
         if (empty($metadata['title'][0])) {
@@ -765,16 +765,16 @@  discard block
 block discarded – undo
765 765
     protected function loadLocation($location)
766 766
     {
767 767
         $fileResource = Helper::getUrl($location);
768
-        if ($fileResource !== false) {
768
+        if ($fileResource !== FALSE) {
769 769
             $xml = Helper::getXmlFileAsString($fileResource);
770 770
             // Set some basic properties.
771
-            if ($xml !== false) {
771
+            if ($xml !== FALSE) {
772 772
                 $this->xml = $xml;
773
-                return true;
773
+                return TRUE;
774 774
             }
775 775
         }
776 776
         $this->logger->error('Could not load XML file from "' . $location . '"');
777
-        return false;
777
+        return FALSE;
778 778
     }
779 779
 
780 780
     /**
@@ -798,9 +798,9 @@  discard block
 block discarded – undo
798 798
 
799 799
         if ($preloadedDocument instanceof \SimpleXMLElement) {
800 800
             $this->xml = $preloadedDocument;
801
-            return true;
801
+            return TRUE;
802 802
         }
803
-        return false;
803
+        return FALSE;
804 804
     }
805 805
 
806 806
     /**
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
             foreach ($this->mets->xpath('./mets:dmdSec') as $dmdSecTag) {
828 828
                 $dmdSec = $this->processMdSec($dmdSecTag);
829 829
 
830
-                if ($dmdSec !== null) {
830
+                if ($dmdSec !== NULL) {
831 831
                     $this->mdSec[$dmdSec['id']] = $dmdSec;
832 832
                     $this->dmdSec[$dmdSec['id']] = $dmdSec;
833 833
                 }
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
                     // TODO: Should we check that the format may occur within this type (e.g., to ignore VIDEOMD within rightsMD)?
845 845
                     $mdSec = $this->processMdSec($mdSecTag);
846 846
 
847
-                    if ($mdSec !== null) {
847
+                    if ($mdSec !== NULL) {
848 848
                         $this->mdSec[$mdSec['id']] = $mdSec;
849 849
 
850 850
                         $childIds[] = $mdSec['id'];
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
                 }
858 858
             }
859 859
 
860
-            $this->mdSecLoaded = true;
860
+            $this->mdSecLoaded = TRUE;
861 861
         }
862 862
         return $this->mdSec;
863 863
     }
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
     {
882 882
         $mdId = (string) $element->attributes()->ID;
883 883
         if (empty($mdId)) {
884
-            return null;
884
+            return NULL;
885 885
         }
886 886
 
887 887
         $this->registerNamespaces($element);
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
         }
899 899
 
900 900
         if (empty($xml)) {
901
-            return null;
901
+            return NULL;
902 902
         }
903 903
 
904 904
         $this->registerNamespaces($xml[0]);
@@ -959,9 +959,9 @@  discard block
 block discarded – undo
959 959
                 !empty($extConf['fileGrpFulltext'])
960 960
                 && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== []
961 961
             ) {
962
-                $this->hasFulltext = true;
962
+                $this->hasFulltext = TRUE;
963 963
             }
964
-            $this->fileGrpsLoaded = true;
964
+            $this->fileGrpsLoaded = TRUE;
965 965
         }
966 966
         return $this->fileGrps;
967 967
     }
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
                     $this->physicalStructure = array_merge($physSeq, $elements);
1064 1064
                 }
1065 1065
             }
1066
-            $this->physicalStructureLoaded = true;
1066
+            $this->physicalStructureLoaded = TRUE;
1067 1067
         }
1068 1068
         return $this->physicalStructure;
1069 1069
     }
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
                     $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from;
1083 1083
                 }
1084 1084
             }
1085
-            $this->smLinksLoaded = true;
1085
+            $this->smLinksLoaded = TRUE;
1086 1086
         }
1087 1087
         return $this->smLinks;
1088 1088
     }
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
      * {@inheritDoc}
1092 1092
      * @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
1093 1093
      */
1094
-    protected function _getThumbnail($forceReload = false)
1094
+    protected function _getThumbnail($forceReload = FALSE)
1095 1095
     {
1096 1096
         if (
1097 1097
             !$this->thumbnailLoaded
@@ -1101,14 +1101,14 @@  discard block
 block discarded – undo
1101 1101
             $cPid = ($this->cPid ? $this->cPid : $this->pid);
1102 1102
             if (!$cPid) {
1103 1103
                 $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions');
1104
-                $this->thumbnailLoaded = true;
1104
+                $this->thumbnailLoaded = TRUE;
1105 1105
                 return $this->thumbnail;
1106 1106
             }
1107 1107
             // Load extension configuration.
1108 1108
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
1109 1109
             if (empty($extConf['fileGrpThumbs'])) {
1110 1110
                 $this->logger->warning('No fileGrp for thumbnails specified');
1111
-                $this->thumbnailLoaded = true;
1111
+                $this->thumbnailLoaded = TRUE;
1112 1112
                 return $this->thumbnail;
1113 1113
             }
1114 1114
             $strctId = $this->_getToplevelId();
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
             } else {
1163 1163
                 $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database');
1164 1164
             }
1165
-            $this->thumbnailLoaded = true;
1165
+            $this->thumbnailLoaded = TRUE;
1166 1166
         }
1167 1167
         return $this->thumbnail;
1168 1168
     }
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
      */
1204 1204
     public function _getParentHref()
1205 1205
     {
1206
-        if ($this->parentHref === null) {
1206
+        if ($this->parentHref === NULL) {
1207 1207
             $this->parentHref = '';
1208 1208
 
1209 1209
             // Get the closest ancestor of the current document which has a MPTR child.
@@ -1241,8 +1241,8 @@  discard block
 block discarded – undo
1241 1241
     public function __toString()
1242 1242
     {
1243 1243
         $xml = new \DOMDocument('1.0', 'utf-8');
1244
-        $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true));
1245
-        $xml->formatOutput = true;
1244
+        $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE));
1245
+        $xml->formatOutput = TRUE;
1246 1246
         return $xml->saveXML();
1247 1247
     }
1248 1248
 
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
     public function __wakeup()
1258 1258
     {
1259 1259
         $xml = Helper::getXmlFileAsString($this->asXML);
1260
-        if ($xml !== false) {
1260
+        if ($xml !== FALSE) {
1261 1261
             $this->asXML = '';
1262 1262
             $this->xml = $xml;
1263 1263
             // Rebuild the unserializable properties.
Please login to merge, or discard this patch.
Braces   +32 added lines, -64 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
  * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF)
51 51
  * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available
52 52
  */
53
-final class MetsDocument extends Doc
54
-{
53
+final class MetsDocument extends Doc {
55 54
     /**
56 55
      * Subsections / tags that may occur within `<mets:amdSec>`.
57 56
      *
@@ -176,8 +175,7 @@  discard block
 block discarded – undo
176 175
      *
177 176
      * @return  void
178 177
      */
179
-    public function addMetadataFromMets(&$metadata, $id)
180
-    {
178
+    public function addMetadataFromMets(&$metadata, $id) {
181 179
         $details = $this->getLogicalStructure($id);
182 180
         if (!empty($details)) {
183 181
             $metadata['mets_order'][0] = $details['order'];
@@ -191,8 +189,7 @@  discard block
 block discarded – undo
191 189
      * {@inheritDoc}
192 190
      * @see \Kitodo\Dlf\Common\Doc::establishRecordId()
193 191
      */
194
-    protected function establishRecordId($pid)
195
-    {
192
+    protected function establishRecordId($pid) {
196 193
         // Check for METS object @ID.
197 194
         if (!empty($this->mets['OBJID'])) {
198 195
             $this->recordId = (string) $this->mets['OBJID'];
@@ -212,8 +209,7 @@  discard block
 block discarded – undo
212 209
      * {@inheritDoc}
213 210
      * @see \Kitodo\Dlf\Common\Doc::getDownloadLocation()
214 211
      */
215
-    public function getDownloadLocation($id)
216
-    {
212
+    public function getDownloadLocation($id) {
217 213
         $fileMimeType = $this->getFileMimeType($id);
218 214
         $fileLocation = $this->getFileLocation($id);
219 215
         if ($fileMimeType === 'application/vnd.kitodo.iiif') {
@@ -238,8 +234,7 @@  discard block
 block discarded – undo
238 234
      * {@inheritDoc}
239 235
      * @see \Kitodo\Dlf\Common\Doc::getFileLocation()
240 236
      */
241
-    public function getFileLocation($id)
242
-    {
237
+    public function getFileLocation($id) {
243 238
         $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]');
244 239
         if (
245 240
             !empty($id)
@@ -256,8 +251,7 @@  discard block
 block discarded – undo
256 251
      * {@inheritDoc}
257 252
      * @see \Kitodo\Dlf\Common\Doc::getFileMimeType()
258 253
      */
259
-    public function getFileMimeType($id)
260
-    {
254
+    public function getFileMimeType($id) {
261 255
         $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE');
262 256
         if (
263 257
             !empty($id)
@@ -274,8 +268,7 @@  discard block
 block discarded – undo
274 268
      * {@inheritDoc}
275 269
      * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure()
276 270
      */
277
-    public function getLogicalStructure($id, $recursive = false)
278
-    {
271
+    public function getLogicalStructure($id, $recursive = false) {
279 272
         $details = [];
280 273
         // Is the requested logical unit already loaded?
281 274
         if (
@@ -315,8 +308,7 @@  discard block
 block discarded – undo
315 308
      *
316 309
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
317 310
      */
318
-    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false)
319
-    {
311
+    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) {
320 312
         // Get attributes.
321 313
         foreach ($structure->attributes() as $attribute => $value) {
322 314
             $attributes[$attribute] = (string) $value;
@@ -420,8 +412,7 @@  discard block
 block discarded – undo
420 412
      * {@inheritDoc}
421 413
      * @see \Kitodo\Dlf\Common\Doc::getMetadata()
422 414
      */
423
-    public function getMetadata($id, $cPid = 0)
424
-    {
415
+    public function getMetadata($id, $cPid = 0) {
425 416
         // Make sure $cPid is a non-negative integer.
426 417
         $cPid = max(intval($cPid), 0);
427 418
         // If $cPid is not given, try to get it elsewhere.
@@ -675,8 +666,7 @@  discard block
 block discarded – undo
675 666
      * @param string $id: The "@ID" attribute of the file node
676 667
      * @return void
677 668
      */
678
-    protected function getMetadataIds($id)
679
-    {
669
+    protected function getMetadataIds($id) {
680 670
         // Load amdSecChildIds concordance
681 671
         $this->_getMdSec();
682 672
         $this->_getFileInfos();
@@ -723,8 +713,7 @@  discard block
 block discarded – undo
723 713
      * {@inheritDoc}
724 714
      * @see \Kitodo\Dlf\Common\Doc::getFullText()
725 715
      */
726
-    public function getFullText($id)
727
-    {
716
+    public function getFullText($id) {
728 717
         $fullText = '';
729 718
 
730 719
         // Load fileGrps and check for full text files.
@@ -739,8 +728,7 @@  discard block
 block discarded – undo
739 728
      * {@inheritDoc}
740 729
      * @see Doc::getStructureDepth()
741 730
      */
742
-    public function getStructureDepth($logId)
743
-    {
731
+    public function getStructureDepth($logId) {
744 732
         $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
745 733
         if (!empty($ancestors)) {
746 734
             return count($ancestors);
@@ -753,8 +741,7 @@  discard block
 block discarded – undo
753 741
      * {@inheritDoc}
754 742
      * @see \Kitodo\Dlf\Common\Doc::init()
755 743
      */
756
-    protected function init($location)
757
-    {
744
+    protected function init($location) {
758 745
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_class($this));
759 746
         // Get METS node from XML file.
760 747
         $this->registerNamespaces($this->xml);
@@ -778,8 +765,7 @@  discard block
 block discarded – undo
778 765
      * {@inheritDoc}
779 766
      * @see \Kitodo\Dlf\Common\Doc::loadLocation()
780 767
      */
781
-    protected function loadLocation($location)
782
-    {
768
+    protected function loadLocation($location) {
783 769
         $fileResource = Helper::getUrl($location);
784 770
         if ($fileResource !== false) {
785 771
             $xml = Helper::getXmlFileAsString($fileResource);
@@ -797,8 +783,7 @@  discard block
 block discarded – undo
797 783
      * {@inheritDoc}
798 784
      * @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet()
799 785
      */
800
-    protected function ensureHasFulltextIsSet()
801
-    {
786
+    protected function ensureHasFulltextIsSet() {
802 787
         // Are the fileGrps already loaded?
803 788
         if (!$this->fileGrpsLoaded) {
804 789
             $this->_getFileGrps();
@@ -809,8 +794,7 @@  discard block
 block discarded – undo
809 794
      * {@inheritDoc}
810 795
      * @see Doc::setPreloadedDocument()
811 796
      */
812
-    protected function setPreloadedDocument($preloadedDocument)
813
-    {
797
+    protected function setPreloadedDocument($preloadedDocument) {
814 798
 
815 799
         if ($preloadedDocument instanceof \SimpleXMLElement) {
816 800
             $this->xml = $preloadedDocument;
@@ -823,8 +807,7 @@  discard block
 block discarded – undo
823 807
      * {@inheritDoc}
824 808
      * @see Doc::getDocument()
825 809
      */
826
-    protected function getDocument()
827
-    {
810
+    protected function getDocument() {
828 811
         return $this->mets;
829 812
     }
830 813
 
@@ -835,8 +818,7 @@  discard block
 block discarded – undo
835 818
      *
836 819
      * @return array Array of metadata sections with their IDs as array key
837 820
      */
838
-    protected function _getMdSec()
839
-    {
821
+    protected function _getMdSec() {
840 822
         if (!$this->mdSecLoaded) {
841 823
             $this->loadFormats();
842 824
 
@@ -878,8 +860,7 @@  discard block
 block discarded – undo
878 860
         return $this->mdSec;
879 861
     }
880 862
 
881
-    protected function _getDmdSec()
882
-    {
863
+    protected function _getDmdSec() {
883 864
         $this->_getMdSec();
884 865
         return $this->dmdSec;
885 866
     }
@@ -893,8 +874,7 @@  discard block
 block discarded – undo
893 874
      *
894 875
      * @return array|null The processed metadata section
895 876
      */
896
-    protected function processMdSec($element)
897
-    {
877
+    protected function processMdSec($element) {
898 878
         $mdId = (string) $element->attributes()->ID;
899 879
         if (empty($mdId)) {
900 880
             return null;
@@ -934,8 +914,7 @@  discard block
 block discarded – undo
934 914
      *
935 915
      * @return array Array of file use groups with file IDs
936 916
      */
937
-    protected function _getFileGrps()
938
-    {
917
+    protected function _getFileGrps() {
939 918
         if (!$this->fileGrpsLoaded) {
940 919
             // Get configured USE attributes.
941 920
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -987,8 +966,7 @@  discard block
 block discarded – undo
987 966
      * @access protected
988 967
      * @return array
989 968
      */
990
-    protected function _getFileInfos()
991
-    {
969
+    protected function _getFileInfos() {
992 970
         $this->_getFileGrps();
993 971
         return $this->fileInfos;
994 972
     }
@@ -997,8 +975,7 @@  discard block
 block discarded – undo
997 975
      * {@inheritDoc}
998 976
      * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray()
999 977
      */
1000
-    protected function prepareMetadataArray($cPid)
1001
-    {
978
+    protected function prepareMetadataArray($cPid) {
1002 979
         $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID');
1003 980
         // Get all logical structure nodes with metadata.
1004 981
         if (!empty($ids)) {
@@ -1016,8 +993,7 @@  discard block
 block discarded – undo
1016 993
      *
1017 994
      * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object
1018 995
      */
1019
-    protected function _getMets()
1020
-    {
996
+    protected function _getMets() {
1021 997
         return $this->mets;
1022 998
     }
1023 999
 
@@ -1025,8 +1001,7 @@  discard block
 block discarded – undo
1025 1001
      * {@inheritDoc}
1026 1002
      * @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure()
1027 1003
      */
1028
-    protected function _getPhysicalStructure()
1029
-    {
1004
+    protected function _getPhysicalStructure() {
1030 1005
         // Is there no physical structure array yet?
1031 1006
         if (!$this->physicalStructureLoaded) {
1032 1007
             // Does the document have a structMap node of type "PHYSICAL"?
@@ -1088,8 +1063,7 @@  discard block
 block discarded – undo
1088 1063
      * {@inheritDoc}
1089 1064
      * @see \Kitodo\Dlf\Common\Doc::_getSmLinks()
1090 1065
      */
1091
-    protected function _getSmLinks()
1092
-    {
1066
+    protected function _getSmLinks() {
1093 1067
         if (!$this->smLinksLoaded) {
1094 1068
             $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink');
1095 1069
             if (!empty($smLinks)) {
@@ -1107,8 +1081,7 @@  discard block
 block discarded – undo
1107 1081
      * {@inheritDoc}
1108 1082
      * @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
1109 1083
      */
1110
-    protected function _getThumbnail($forceReload = false)
1111
-    {
1084
+    protected function _getThumbnail($forceReload = false) {
1112 1085
         if (
1113 1086
             !$this->thumbnailLoaded
1114 1087
             || $forceReload
@@ -1187,8 +1160,7 @@  discard block
 block discarded – undo
1187 1160
      * {@inheritDoc}
1188 1161
      * @see \Kitodo\Dlf\Common\Doc::_getToplevelId()
1189 1162
      */
1190
-    protected function _getToplevelId()
1191
-    {
1163
+    protected function _getToplevelId() {
1192 1164
         if (empty($this->toplevelId)) {
1193 1165
             // Get all logical structure nodes with metadata, but without associated METS-Pointers.
1194 1166
             $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]');
@@ -1217,8 +1189,7 @@  discard block
 block discarded – undo
1217 1189
      *
1218 1190
      * @return string|null
1219 1191
      */
1220
-    public function _getParentHref()
1221
-    {
1192
+    public function _getParentHref() {
1222 1193
         if ($this->parentHref === null) {
1223 1194
             $this->parentHref = '';
1224 1195
 
@@ -1240,8 +1211,7 @@  discard block
 block discarded – undo
1240 1211
      *
1241 1212
      * @return array Properties to be serialized
1242 1213
      */
1243
-    public function __sleep()
1244
-    {
1214
+    public function __sleep() {
1245 1215
         // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization
1246 1216
         $this->asXML = $this->xml->asXML();
1247 1217
         return ['uid', 'pid', 'recordId', 'parentId', 'asXML'];
@@ -1254,8 +1224,7 @@  discard block
 block discarded – undo
1254 1224
      *
1255 1225
      * @return string String representing the METS object
1256 1226
      */
1257
-    public function __toString()
1258
-    {
1227
+    public function __toString() {
1259 1228
         $xml = new \DOMDocument('1.0', 'utf-8');
1260 1229
         $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true));
1261 1230
         $xml->formatOutput = true;
@@ -1270,8 +1239,7 @@  discard block
 block discarded – undo
1270 1239
      *
1271 1240
      * @return void
1272 1241
      */
1273
-    public function __wakeup()
1274
-    {
1242
+    public function __wakeup() {
1275 1243
         $xml = Helper::getXmlFileAsString($this->asXML);
1276 1244
         if ($xml !== false) {
1277 1245
             $this->asXML = '';
Please login to merge, or discard this patch.