Passed
Pull Request — master (#105)
by Alexander
05:13
created
Classes/Common/Solr.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     {
135 135
         // Get next available core name if none given.
136 136
         if (empty($core)) {
137
-            $core = 'dlfCore' . self::getNextCoreNumber();
137
+            $core = 'dlfCore'.self::getNextCoreNumber();
138 138
         }
139 139
         // Get Solr service instance.
140 140
         $solr = self::getInstance($core);
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
                 ->execute();
231 231
 
232 232
             while ($resArray = $result->fetch()) {
233
-                $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i';
233
+                $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i';
234 234
             }
235 235
 
236 236
             // Check if queried field is valid.
237 237
             $splitQuery = explode(':', $query, 2);
238 238
             if (in_array($splitQuery[0], $fields)) {
239
-                $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')';
239
+                $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')';
240 240
             } else {
241 241
                 $query = self::escapeQuery($query);
242 242
             }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     {
342 342
         $number = max(intval($number), 0);
343 343
         // Check if core already exists.
344
-        $solr = self::getInstance('dlfCore' . $number);
344
+        $solr = self::getInstance('dlfCore'.$number);
345 345
         if (!$solr->ready) {
346 346
             return $number;
347 347
         } else {
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         $parameters['start'] = 0;
404 404
         $parameters['rows'] = $this->limit;
405 405
         // Calculate cache identifier.
406
-        $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true));
406
+        $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true));
407 407
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
408 408
         $resultSet = [];
409 409
         if (($entry = $cache->get($cacheIdentifier)) === false) {
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
      */
535 535
     public function __get($var)
536 536
     {
537
-        $method = '_get' . ucfirst($var);
537
+        $method = '_get'.ucfirst($var);
538 538
         if (
539 539
             !property_exists($this, $var)
540 540
             || !method_exists($this, $method)
541 541
         ) {
542
-            $this->logger->warning('There is no getter function for property "' . $var . '"');
542
+            $this->logger->warning('There is no getter function for property "'.$var.'"');
543 543
             return;
544 544
         } else {
545 545
             return $this->$method();
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
      */
573 573
     public function __set($var, $value)
574 574
     {
575
-        $method = '_set' . ucfirst($var);
575
+        $method = '_set'.ucfirst($var);
576 576
         if (
577 577
             !property_exists($this, $var)
578 578
             || !method_exists($this, $method)
579 579
         ) {
580
-            $this->logger->warning('There is no setter function for property "' . $var . '"');
580
+            $this->logger->warning('There is no setter function for property "'.$var.'"');
581 581
         } else {
582 582
             $this->$method($value);
583 583
         }
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
                     'scheme' => $this->config['scheme'],
615 615
                     'host' => $this->config['host'],
616 616
                     'port' => $this->config['port'],
617
-                    'path' => '/' . $this->config['path'],
617
+                    'path' => '/'.$this->config['path'],
618 618
                     'core' => $core,
619 619
                     'username' => $this->config['username'],
620 620
                     'password' => $this->config['password'],
Please login to merge, or discard this patch.
Braces   +21 added lines, -42 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
  * @property-read bool $ready Is the Solr service instantiated successfully?
38 38
  * @property-read \Solarium\Client $service This holds the Solr service object
39 39
  */
40
-class Solr implements LoggerAwareInterface
41
-{
40
+class Solr implements LoggerAwareInterface {
42 41
     use LoggerAwareTrait;
43 42
 
44 43
     /**
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
      *
131 130
      * @return string The name of the new core
132 131
      */
133
-    public static function createCore($core = '')
134
-    {
132
+    public static function createCore($core = '') {
135 133
         // Get next available core name if none given.
136 134
         if (empty($core)) {
137 135
             $core = 'dlfCore' . self::getNextCoreNumber();
@@ -178,8 +176,7 @@  discard block
 block discarded – undo
178 176
      *
179 177
      * @return string The escaped query string
180 178
      */
181
-    public static function escapeQuery($query)
182
-    {
179
+    public static function escapeQuery($query) {
183 180
         $helper = GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class);
184 181
         // Escape query phrase or term.
185 182
         if (preg_match('/^".*"$/', $query)) {
@@ -202,8 +199,7 @@  discard block
 block discarded – undo
202 199
      *
203 200
      * @return string The escaped query string
204 201
      */
205
-    public static function escapeQueryKeepField($query, $pid)
206
-    {
202
+    public static function escapeQueryKeepField($query, $pid) {
207 203
         // Is there a field query?
208 204
         if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) {
209 205
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
@@ -253,8 +249,7 @@  discard block
 block discarded – undo
253 249
      *
254 250
      * @return array fields
255 251
      */
256
-    public static function getFields()
257
-    {
252
+    public static function getFields() {
258 253
         $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
259 254
 
260 255
         $fields = [];
@@ -296,8 +291,7 @@  discard block
 block discarded – undo
296 291
      *
297 292
      * @return \Kitodo\Dlf\Common\Solr Instance of this class
298 293
      */
299
-    public static function getInstance($core = null)
300
-    {
294
+    public static function getInstance($core = null) {
301 295
         // Get core name if UID is given.
302 296
         if (MathUtility::canBeInterpretedAsInteger($core)) {
303 297
             $core = Helper::getIndexNameFromUid($core, 'tx_dlf_solrcores');
@@ -337,8 +331,7 @@  discard block
 block discarded – undo
337 331
      *
338 332
      * @return int First unused core number found
339 333
      */
340
-    public static function getNextCoreNumber($number = 0)
341
-    {
334
+    public static function getNextCoreNumber($number = 0) {
342 335
         $number = max(intval($number), 0);
343 336
         // Check if core already exists.
344 337
         $solr = self::getInstance('dlfCore' . $number);
@@ -356,8 +349,7 @@  discard block
 block discarded – undo
356 349
      *
357 350
      * @return void
358 351
      */
359
-    protected function loadSolrConnectionInfo()
360
-    {
352
+    protected function loadSolrConnectionInfo() {
361 353
         if (empty($this->config)) {
362 354
             $config = [];
363 355
             // Extract extension configuration.
@@ -397,8 +389,7 @@  discard block
 block discarded – undo
397 389
      *
398 390
      * @return array The Apache Solr Documents that were fetched
399 391
      */
400
-    public function search_raw($parameters = [])
401
-    {
392
+    public function search_raw($parameters = []) {
402 393
         // Set additional query parameters.
403 394
         $parameters['start'] = 0;
404 395
         $parameters['rows'] = $this->limit;
@@ -428,8 +419,7 @@  discard block
 block discarded – undo
428 419
      *
429 420
      * @return string|null The core name of the current query endpoint or null if core admin endpoint
430 421
      */
431
-    protected function _getCore()
432
-    {
422
+    protected function _getCore() {
433 423
         return $this->core;
434 424
     }
435 425
 
@@ -440,8 +430,7 @@  discard block
 block discarded – undo
440 430
      *
441 431
      * @return int The max number of results
442 432
      */
443
-    protected function _getLimit()
444
-    {
433
+    protected function _getLimit() {
445 434
         return $this->limit;
446 435
     }
447 436
 
@@ -452,8 +441,7 @@  discard block
 block discarded – undo
452 441
      *
453 442
      * @return int Total number of hits for last search
454 443
      */
455
-    protected function _getNumberOfHits()
456
-    {
444
+    protected function _getNumberOfHits() {
457 445
         return $this->numberOfHits;
458 446
     }
459 447
 
@@ -464,8 +452,7 @@  discard block
 block discarded – undo
464 452
      *
465 453
      * @return bool Is the search instantiated successfully?
466 454
      */
467
-    protected function _getReady()
468
-    {
455
+    protected function _getReady() {
469 456
         return $this->ready;
470 457
     }
471 458
 
@@ -476,8 +463,7 @@  discard block
 block discarded – undo
476 463
      *
477 464
      * @return \Solarium\Client Apache Solr service object
478 465
      */
479
-    protected function _getService()
480
-    {
466
+    protected function _getService() {
481 467
         return $this->service;
482 468
     }
483 469
 
@@ -490,8 +476,7 @@  discard block
 block discarded – undo
490 476
      *
491 477
      * @return void
492 478
      */
493
-    protected function _setCPid($value)
494
-    {
479
+    protected function _setCPid($value) {
495 480
         $this->cPid = max(intval($value), 0);
496 481
     }
497 482
 
@@ -504,8 +489,7 @@  discard block
 block discarded – undo
504 489
      *
505 490
      * @return void
506 491
      */
507
-    protected function _setLimit($value)
508
-    {
492
+    protected function _setLimit($value) {
509 493
         $this->limit = max(intval($value), 0);
510 494
     }
511 495
 
@@ -518,8 +502,7 @@  discard block
 block discarded – undo
518 502
      *
519 503
      * @return void
520 504
      */
521
-    protected function _setParams(array $value)
522
-    {
505
+    protected function _setParams(array $value) {
523 506
         $this->params = $value;
524 507
     }
525 508
 
@@ -532,8 +515,7 @@  discard block
 block discarded – undo
532 515
      *
533 516
      * @return mixed Value of $this->$var
534 517
      */
535
-    public function __get($var)
536
-    {
518
+    public function __get($var) {
537 519
         $method = '_get' . ucfirst($var);
538 520
         if (
539 521
             !property_exists($this, $var)
@@ -555,8 +537,7 @@  discard block
 block discarded – undo
555 537
      *
556 538
      * @return bool true if variable is set and not empty, false otherwise
557 539
      */
558
-    public function __isset($var)
559
-    {
540
+    public function __isset($var) {
560 541
         return !empty($this->__get($var));
561 542
     }
562 543
 
@@ -570,8 +551,7 @@  discard block
 block discarded – undo
570 551
      *
571 552
      * @return void
572 553
      */
573
-    public function __set($var, $value)
574
-    {
554
+    public function __set($var, $value) {
575 555
         $method = '_set' . ucfirst($var);
576 556
         if (
577 557
             !property_exists($this, $var)
@@ -592,8 +572,7 @@  discard block
 block discarded – undo
592 572
      *
593 573
      * @return void
594 574
      */
595
-    protected function __construct($core)
596
-    {
575
+    protected function __construct($core) {
597 576
         // Get Solr connection parameters from configuration.
598 577
         $this->loadSolrConnectionInfo();
599 578
         // Configure connection adapter.
Please login to merge, or discard this patch.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @var string|null
56 56
      * @access protected
57 57
      */
58
-    protected $core = null;
58
+    protected $core = NULL;
59 59
 
60 60
     /**
61 61
      * This holds the PID for the configuration
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @var bool
104 104
      * @access protected
105 105
      */
106
-    protected $ready = false;
106
+    protected $ready = FALSE;
107 107
 
108 108
     /**
109 109
      * This holds the singleton search objects with their core as array key
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      *
297 297
      * @return \Kitodo\Dlf\Common\Solr Instance of this class
298 298
      */
299
-    public static function getInstance($core = null)
299
+    public static function getInstance($core = NULL)
300 300
     {
301 301
         // Get core name if UID is given.
302 302
         if (MathUtility::canBeInterpretedAsInteger($core)) {
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         // Check if core is set or null.
306 306
         if (
307 307
             empty($core)
308
-            && $core !== null
308
+            && $core !== NULL
309 309
         ) {
310 310
             Helper::log('Invalid core UID or name given for Apache Solr', LOG_SEVERITY_ERROR);
311 311
         }
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
         $parameters['start'] = 0;
404 404
         $parameters['rows'] = $this->limit;
405 405
         // Calculate cache identifier.
406
-        $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true));
406
+        $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), TRUE));
407 407
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
408 408
         $resultSet = [];
409
-        if (($entry = $cache->get($cacheIdentifier)) === false) {
409
+        if (($entry = $cache->get($cacheIdentifier)) === FALSE) {
410 410
             $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters));
411 411
             $result = $this->service->select($selectQuery);
412 412
             foreach ($result as $doc) {
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
         // Check if connection is established.
633 633
         $query = $this->service->createCoreAdmin();
634 634
         $action = $query->createStatus();
635
-        if ($core !== null) {
635
+        if ($core !== NULL) {
636 636
             $action->setCore($core);
637 637
         }
638 638
         $query->setAction($action);
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
             $response = $this->service->coreAdmin($query);
641 641
             if ($response->getWasSuccessful()) {
642 642
                 // Solr is reachable, but is the core as well?
643
-                if ($core !== null) {
643
+                if ($core !== NULL) {
644 644
                     $result = $response->getStatusResult();
645 645
                     if (
646 646
                         $result instanceof \Solarium\QueryType\Server\CoreAdmin\Result\StatusResult
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
                     }
655 655
                 }
656 656
                 // Instantiation successful!
657
-                $this->ready = true;
657
+                $this->ready = TRUE;
658 658
             }
659 659
         } catch (\Exception $e) {
660 660
             // Nothing to do here.
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
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $fileMimeType = $this->getFileMimeType($id);
169 169
         $fileLocation = $this->getFileLocation($id);
170 170
         if ($fileMimeType === 'application/vnd.kitodo.iiif') {
171
-            $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation . 'info.json' : $fileLocation . '/info.json');
171
+            $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation.'info.json' : $fileLocation.'/info.json');
172 172
             $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
173 173
             IiifHelper::setUrlReader(IiifUrlReader::getInstance());
174 174
             IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']);
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
                 return $service->getImageUrl();
179 179
             }
180 180
         } elseif ($fileMimeType === 'application/vnd.netfpx') {
181
-            $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : '');
181
+            $baseURL = $fileLocation.(strpos($fileLocation, '?') === false ? '?' : '');
182 182
             // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server'
183
-            return $baseURL . '&CVT=jpeg';
183
+            return $baseURL.'&CVT=jpeg';
184 184
         }
185 185
         return $fileLocation;
186 186
     }
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function getFileLocation($id)
193 193
     {
194
-        $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]');
194
+        $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]');
195 195
         if (
196 196
             !empty($id)
197 197
             && !empty($location)
198 198
         ) {
199 199
             return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href;
200 200
         } else {
201
-            $this->logger->warning('There is no file node with @ID "' . $id . '"');
201
+            $this->logger->warning('There is no file node with @ID "'.$id.'"');
202 202
             return '';
203 203
         }
204 204
     }
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function getFileMimeType($id)
211 211
     {
212
-        $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE');
212
+        $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE');
213 213
         if (
214 214
             !empty($id)
215 215
             && !empty($mimetype)
216 216
         ) {
217 217
             return (string) $mimetype[0];
218 218
         } else {
219
-            $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified');
219
+            $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified');
220 220
             return '';
221 221
         }
222 222
     }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
             return $this->logicalUnits[$id];
238 238
         } elseif (!empty($id)) {
239 239
             // Get specified logical unit.
240
-            $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]');
240
+            $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]');
241 241
         } else {
242 242
             // Get all logical units at top level.
243 243
             $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div');
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             // Retain current PID.
378 378
             $cPid = ($this->cPid ? $this->cPid : $this->pid);
379 379
         } elseif (!$cPid) {
380
-            $this->logger->warning('Invalid PID ' . $cPid . ' for metadata definitions');
380
+            $this->logger->warning('Invalid PID '.$cPid.' for metadata definitions');
381 381
             return [];
382 382
         }
383 383
         // Get metadata from parsed metadata array if available.
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         if (!empty($this->logicalUnits[$id])) {
419 419
             $dmdIds = $this->logicalUnits[$id]['dmdId'];
420 420
         } else {
421
-            $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@DMDID');
421
+            $dmdIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@DMDID');
422 422
             $dmdIds = (string) $dmdIds[0];
423 423
         }
424 424
         if (!empty($dmdIds)) {
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
                     ) {
445 445
                         $obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata);
446 446
                     } else {
447
-                        $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->dmdSec[$dmdId]['type'] . '"');
447
+                        $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"');
448 448
                     }
449 449
                 }
450 450
             } else {
451
-                $this->logger->notice('Unsupported metadata format "' . $this->dmdSec[$dmdId]['type'] . '" in dmdSec with @ID "' . $dmdId . '"');
451
+                $this->logger->notice('Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"');
452 452
                 // Continue searching for supported metadata with next @DMDID.
453 453
                 continue;
454 454
             }
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
             if (!empty($this->logicalUnits[$id])) {
457 457
                 $metadata['type'] = [$this->logicalUnits[$id]['type']];
458 458
             } else {
459
-                $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE');
459
+                $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE');
460 460
                 if (!empty($struct)) {
461 461
                     $metadata['type'] = [(string) $struct[0]];
462 462
                 }
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
                             $values instanceof \DOMNodeList
574 574
                             && $values->length > 0
575 575
                         ) {
576
-                            $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue);
576
+                            $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue);
577 577
                         } elseif (!($values instanceof \DOMNodeList)) {
578
-                            $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values);
578
+                            $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values);
579 579
                         }
580 580
                     }
581
-                    if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) {
582
-                        $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0];
581
+                    if (empty($metadata[$resArray['index_name'].'_sorting'][0])) {
582
+                        $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0];
583 583
                     }
584 584
                 }
585 585
             }
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
         if ($hasSupportedMetadata) {
596 596
             return $metadata;
597 597
         } else {
598
-            $this->logger->warning('No supported metadata found for logical structure with @ID "' . $id . '"');
598
+            $this->logger->warning('No supported metadata found for logical structure with @ID "'.$id.'"');
599 599
             return [];
600 600
         }
601 601
     }
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
      */
623 623
     public function getStructureDepth($logId)
624 624
     {
625
-        $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
625
+        $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*');
626 626
         if (!empty($ancestors)) {
627 627
             return count($ancestors);
628 628
         } else {
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
             $this->registerNamespaces($this->mets);
647 647
         } else {
648 648
             if (!empty($location)) {
649
-                $this->logger->error('No METS part found in document with location "' . $location . '".');
649
+                $this->logger->error('No METS part found in document with location "'.$location.'".');
650 650
             } else if (!empty($this->recordId)) {
651
-                $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".');
651
+                $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".');
652 652
             } else {
653 653
                 $this->logger->error('No METS part found in current document.');
654 654
             }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
                 return true;
671 671
             }
672 672
         }
673
-        $this->logger->error('Could not load XML file from "' . $location . '"');
673
+        $this->logger->error('Could not load XML file from "'.$location.'"');
674 674
         return false;
675 675
     }
676 676
 
@@ -725,15 +725,15 @@  discard block
 block discarded – undo
725 725
             $dmdIds = $this->mets->xpath('./mets:dmdSec/@ID');
726 726
             if (!empty($dmdIds)) {
727 727
                 foreach ($dmdIds as $dmdId) {
728
-                    if ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) {
728
+                    if ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) {
729 729
                         if (!empty($this->formats[(string) $type[0]])) {
730 730
                             $type = (string) $type[0];
731
-                            $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']);
731
+                            $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
732 732
                         }
733
-                    } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) {
733
+                    } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) {
734 734
                         if (!empty($this->formats[(string) $type[0]])) {
735 735
                             $type = (string) $type[0];
736
-                            $xml = $this->mets->xpath('./mets:dmdSec[@ID="' . (string) $dmdId . '"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']);
736
+                            $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
737 737
                         }
738 738
                     }
739 739
                     if (!empty($xml)) {
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
             // Retain current PID.
919 919
             $cPid = ($this->cPid ? $this->cPid : $this->pid);
920 920
             if (!$cPid) {
921
-                $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions');
921
+                $this->logger->error('Invalid PID '.$cPid.' for structure definitions');
922 922
                 $this->thumbnailLoaded = true;
923 923
                 return $this->thumbnail;
924 924
             }
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
                 if (!empty($resArray['thumbnail'])) {
956 956
                     $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid);
957 957
                     // Check if this document has a structure element of the desired type.
958
-                    $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID');
958
+                    $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID');
959 959
                     if (!empty($strctIds)) {
960 960
                         $strctId = (string) $strctIds[0];
961 961
                     }
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
                     }
979 979
                 }
980 980
             } else {
981
-                $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database');
981
+                $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database');
982 982
             }
983 983
             $this->thumbnailLoaded = true;
984 984
         }
Please login to merge, or discard this patch.
Braces   +27 added lines, -54 removed lines patch added patch discarded remove patch
@@ -47,8 +47,7 @@  discard block
 block discarded – undo
47 47
  * @property-read string $thumbnail This holds the document's thumbnail location
48 48
  * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF)
49 49
  */
50
-final class MetsDocument extends Doc
51
-{
50
+final class MetsDocument extends Doc {
52 51
     /**
53 52
      * This holds the whole XML file as string for serialization purposes
54 53
      * @see __sleep() / __wakeup()
@@ -127,8 +126,7 @@  discard block
 block discarded – undo
127 126
      *
128 127
      * @return  void
129 128
      */
130
-    public function addMetadataFromMets(&$metadata, $id)
131
-    {
129
+    public function addMetadataFromMets(&$metadata, $id) {
132 130
         $details = $this->getLogicalStructure($id);
133 131
         if (!empty($details)) {
134 132
             $metadata['mets_order'][0] = $details['order'];
@@ -142,8 +140,7 @@  discard block
 block discarded – undo
142 140
      * {@inheritDoc}
143 141
      * @see \Kitodo\Dlf\Common\Doc::establishRecordId()
144 142
      */
145
-    protected function establishRecordId($pid)
146
-    {
143
+    protected function establishRecordId($pid) {
147 144
         // Check for METS object @ID.
148 145
         if (!empty($this->mets['OBJID'])) {
149 146
             $this->recordId = (string) $this->mets['OBJID'];
@@ -163,8 +160,7 @@  discard block
 block discarded – undo
163 160
      * {@inheritDoc}
164 161
      * @see \Kitodo\Dlf\Common\Doc::getDownloadLocation()
165 162
      */
166
-    public function getDownloadLocation($id)
167
-    {
163
+    public function getDownloadLocation($id) {
168 164
         $fileMimeType = $this->getFileMimeType($id);
169 165
         $fileLocation = $this->getFileLocation($id);
170 166
         if ($fileMimeType === 'application/vnd.kitodo.iiif') {
@@ -189,8 +185,7 @@  discard block
 block discarded – undo
189 185
      * {@inheritDoc}
190 186
      * @see \Kitodo\Dlf\Common\Doc::getFileLocation()
191 187
      */
192
-    public function getFileLocation($id)
193
-    {
188
+    public function getFileLocation($id) {
194 189
         $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]');
195 190
         if (
196 191
             !empty($id)
@@ -207,8 +202,7 @@  discard block
 block discarded – undo
207 202
      * {@inheritDoc}
208 203
      * @see \Kitodo\Dlf\Common\Doc::getFileMimeType()
209 204
      */
210
-    public function getFileMimeType($id)
211
-    {
205
+    public function getFileMimeType($id) {
212 206
         $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE');
213 207
         if (
214 208
             !empty($id)
@@ -225,8 +219,7 @@  discard block
 block discarded – undo
225 219
      * {@inheritDoc}
226 220
      * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure()
227 221
      */
228
-    public function getLogicalStructure($id, $recursive = false)
229
-    {
222
+    public function getLogicalStructure($id, $recursive = false) {
230 223
         $details = [];
231 224
         // Is the requested logical unit already loaded?
232 225
         if (
@@ -266,8 +259,7 @@  discard block
 block discarded – undo
266 259
      *
267 260
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
268 261
      */
269
-    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false)
270
-    {
262
+    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) {
271 263
         // Get attributes.
272 264
         foreach ($structure->attributes() as $attribute => $value) {
273 265
             $attributes[$attribute] = (string) $value;
@@ -365,8 +357,7 @@  discard block
 block discarded – undo
365 357
      * {@inheritDoc}
366 358
      * @see \Kitodo\Dlf\Common\Doc::getMetadata()
367 359
      */
368
-    public function getMetadata($id, $cPid = 0)
369
-    {
360
+    public function getMetadata($id, $cPid = 0) {
370 361
         // Make sure $cPid is a non-negative integer.
371 362
         $cPid = max(intval($cPid), 0);
372 363
         // If $cPid is not given, try to get it elsewhere.
@@ -604,8 +595,7 @@  discard block
 block discarded – undo
604 595
      * {@inheritDoc}
605 596
      * @see \Kitodo\Dlf\Common\Doc::getFullText()
606 597
      */
607
-    public function getFullText($id)
608
-    {
598
+    public function getFullText($id) {
609 599
         $fullText = '';
610 600
 
611 601
         // Load fileGrps and check for full text files.
@@ -620,8 +610,7 @@  discard block
 block discarded – undo
620 610
      * {@inheritDoc}
621 611
      * @see Doc::getStructureDepth()
622 612
      */
623
-    public function getStructureDepth($logId)
624
-    {
613
+    public function getStructureDepth($logId) {
625 614
         $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
626 615
         if (!empty($ancestors)) {
627 616
             return count($ancestors);
@@ -634,8 +623,7 @@  discard block
 block discarded – undo
634 623
      * {@inheritDoc}
635 624
      * @see \Kitodo\Dlf\Common\Doc::init()
636 625
      */
637
-    protected function init($location)
638
-    {
626
+    protected function init($location) {
639 627
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_class($this));
640 628
         // Get METS node from XML file.
641 629
         $this->registerNamespaces($this->xml);
@@ -659,8 +647,7 @@  discard block
 block discarded – undo
659 647
      * {@inheritDoc}
660 648
      * @see \Kitodo\Dlf\Common\Doc::loadLocation()
661 649
      */
662
-    protected function loadLocation($location)
663
-    {
650
+    protected function loadLocation($location) {
664 651
         $fileResource = Helper::getUrl($location);
665 652
         if ($fileResource !== false) {
666 653
             $xml = Helper::getXmlFileAsString($fileResource);
@@ -678,8 +665,7 @@  discard block
 block discarded – undo
678 665
      * {@inheritDoc}
679 666
      * @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet()
680 667
      */
681
-    protected function ensureHasFulltextIsSet()
682
-    {
668
+    protected function ensureHasFulltextIsSet() {
683 669
         // Are the fileGrps already loaded?
684 670
         if (!$this->fileGrpsLoaded) {
685 671
             $this->_getFileGrps();
@@ -690,8 +676,7 @@  discard block
 block discarded – undo
690 676
      * {@inheritDoc}
691 677
      * @see Doc::setPreloadedDocument()
692 678
      */
693
-    protected function setPreloadedDocument($preloadedDocument)
694
-    {
679
+    protected function setPreloadedDocument($preloadedDocument) {
695 680
 
696 681
         if ($preloadedDocument instanceof \SimpleXMLElement) {
697 682
             $this->xml = $preloadedDocument;
@@ -704,8 +689,7 @@  discard block
 block discarded – undo
704 689
      * {@inheritDoc}
705 690
      * @see Doc::getDocument()
706 691
      */
707
-    protected function getDocument()
708
-    {
692
+    protected function getDocument() {
709 693
         return $this->mets;
710 694
     }
711 695
 
@@ -716,8 +700,7 @@  discard block
 block discarded – undo
716 700
      *
717 701
      * @return array Array of dmdSecs with their IDs as array key
718 702
      */
719
-    protected function _getDmdSec()
720
-    {
703
+    protected function _getDmdSec() {
721 704
         if (!$this->dmdSecLoaded) {
722 705
             // Get available data formats.
723 706
             $this->loadFormats();
@@ -755,8 +738,7 @@  discard block
 block discarded – undo
755 738
      *
756 739
      * @return array Array of file use groups with file IDs
757 740
      */
758
-    protected function _getFileGrps()
759
-    {
741
+    protected function _getFileGrps() {
760 742
         if (!$this->fileGrpsLoaded) {
761 743
             // Get configured USE attributes.
762 744
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -801,8 +783,7 @@  discard block
 block discarded – undo
801 783
      * {@inheritDoc}
802 784
      * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray()
803 785
      */
804
-    protected function prepareMetadataArray($cPid)
805
-    {
786
+    protected function prepareMetadataArray($cPid) {
806 787
         $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID');
807 788
         // Get all logical structure nodes with metadata.
808 789
         if (!empty($ids)) {
@@ -820,8 +801,7 @@  discard block
 block discarded – undo
820 801
      *
821 802
      * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object
822 803
      */
823
-    protected function _getMets()
824
-    {
804
+    protected function _getMets() {
825 805
         return $this->mets;
826 806
     }
827 807
 
@@ -829,8 +809,7 @@  discard block
 block discarded – undo
829 809
      * {@inheritDoc}
830 810
      * @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure()
831 811
      */
832
-    protected function _getPhysicalStructure()
833
-    {
812
+    protected function _getPhysicalStructure() {
834 813
         // Is there no physical structure array yet?
835 814
         if (!$this->physicalStructureLoaded) {
836 815
             // Does the document have a structMap node of type "PHYSICAL"?
@@ -890,8 +869,7 @@  discard block
 block discarded – undo
890 869
      * {@inheritDoc}
891 870
      * @see \Kitodo\Dlf\Common\Doc::_getSmLinks()
892 871
      */
893
-    protected function _getSmLinks()
894
-    {
872
+    protected function _getSmLinks() {
895 873
         if (!$this->smLinksLoaded) {
896 874
             $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink');
897 875
             if (!empty($smLinks)) {
@@ -909,8 +887,7 @@  discard block
 block discarded – undo
909 887
      * {@inheritDoc}
910 888
      * @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
911 889
      */
912
-    protected function _getThumbnail($forceReload = false)
913
-    {
890
+    protected function _getThumbnail($forceReload = false) {
914 891
         if (
915 892
             !$this->thumbnailLoaded
916 893
             || $forceReload
@@ -989,8 +966,7 @@  discard block
 block discarded – undo
989 966
      * {@inheritDoc}
990 967
      * @see \Kitodo\Dlf\Common\Doc::_getToplevelId()
991 968
      */
992
-    protected function _getToplevelId()
993
-    {
969
+    protected function _getToplevelId() {
994 970
         if (empty($this->toplevelId)) {
995 971
             // Get all logical structure nodes with metadata, but without associated METS-Pointers.
996 972
             $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]');
@@ -1022,8 +998,7 @@  discard block
 block discarded – undo
1022 998
      *
1023 999
      * @return array Properties to be serialized
1024 1000
      */
1025
-    public function __sleep()
1026
-    {
1001
+    public function __sleep() {
1027 1002
         // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization
1028 1003
         $this->asXML = $this->xml->asXML();
1029 1004
         return ['uid', 'pid', 'recordId', 'parentId', 'asXML'];
@@ -1036,8 +1011,7 @@  discard block
 block discarded – undo
1036 1011
      *
1037 1012
      * @return string String representing the METS object
1038 1013
      */
1039
-    public function __toString()
1040
-    {
1014
+    public function __toString() {
1041 1015
         $xml = new \DOMDocument('1.0', 'utf-8');
1042 1016
         $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true));
1043 1017
         $xml->formatOutput = true;
@@ -1052,8 +1026,7 @@  discard block
 block discarded – undo
1052 1026
      *
1053 1027
      * @return void
1054 1028
      */
1055
-    public function __wakeup()
1056
-    {
1029
+    public function __wakeup() {
1057 1030
         $xml = Helper::getXmlFileAsString($this->asXML);
1058 1031
         if ($xml !== false) {
1059 1032
             $this->asXML = '';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @var bool
74 74
      * @access protected
75 75
      */
76
-    protected $dmdSecLoaded = false;
76
+    protected $dmdSecLoaded = FALSE;
77 77
 
78 78
     /**
79 79
      * The extension key
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @var bool
100 100
      * @access protected
101 101
      */
102
-    protected $fileGrpsLoaded = false;
102
+    protected $fileGrpsLoaded = FALSE;
103 103
 
104 104
     /**
105 105
      * This holds the XML file's METS part as \SimpleXMLElement object
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
             IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']);
175 175
             IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']);
176 176
             $service = IiifHelper::loadIiifResource($fileLocation);
177
-            if ($service !== null && $service instanceof AbstractImageService) {
177
+            if ($service !== NULL && $service instanceof AbstractImageService) {
178 178
                 return $service->getImageUrl();
179 179
             }
180 180
         } elseif ($fileMimeType === 'application/vnd.netfpx') {
181
-            $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : '');
181
+            $baseURL = $fileLocation . (strpos($fileLocation, '?') === FALSE ? '?' : '');
182 182
             // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server'
183 183
             return $baseURL . '&CVT=jpeg';
184 184
         }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      * {@inheritDoc}
226 226
      * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure()
227 227
      */
228
-    public function getLogicalStructure($id, $recursive = false)
228
+    public function getLogicalStructure($id, $recursive = FALSE)
229 229
     {
230 230
         $details = [];
231 231
         // Is the requested logical unit already loaded?
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      *
267 267
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
268 268
      */
269
-    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false)
269
+    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = FALSE)
270 270
     {
271 271
         // Get attributes.
272 272
         foreach ($structure->attributes() as $attribute => $value) {
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             && array_key_exists($details['id'], $this->smLinks['l2p'])
312 312
         ) {
313 313
             // Link logical structure to the first corresponding physical page/track.
314
-            $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true)), 1);
314
+            $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1);
315 315
             $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']);
316 316
             while ($fileGrpThumb = array_shift($fileGrpsThumb)) {
317 317
                 if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$fileGrpThumb])) {
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             $details['children'] = [];
356 356
             foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) {
357 357
                 // Repeat for all children.
358
-                $details['children'][] = $this->getLogicalStructureInfo($child, true);
358
+                $details['children'][] = $this->getLogicalStructureInfo($child, TRUE);
359 359
             }
360 360
         }
361 361
         return $details;
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         if (!empty($dmdIds)) {
425 425
             // Handle multiple DMDIDs separately.
426 426
             $dmdIds = explode(' ', $dmdIds);
427
-            $hasSupportedMetadata = false;
427
+            $hasSupportedMetadata = FALSE;
428 428
         } else {
429 429
             // There is no dmdSec for this structure node.
430 430
             return [];
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
                 $metadata['title_sorting'][0] = '';
590 590
             }
591 591
             // Extract metadata only from first supported dmdSec.
592
-            $hasSupportedMetadata = true;
592
+            $hasSupportedMetadata = TRUE;
593 593
             break;
594 594
         }
595 595
         if ($hasSupportedMetadata) {
@@ -662,16 +662,16 @@  discard block
 block discarded – undo
662 662
     protected function loadLocation($location)
663 663
     {
664 664
         $fileResource = Helper::getUrl($location);
665
-        if ($fileResource !== false) {
665
+        if ($fileResource !== FALSE) {
666 666
             $xml = Helper::getXmlFileAsString($fileResource);
667 667
             // Set some basic properties.
668
-            if ($xml !== false) {
668
+            if ($xml !== FALSE) {
669 669
                 $this->xml = $xml;
670
-                return true;
670
+                return TRUE;
671 671
             }
672 672
         }
673 673
         $this->logger->error('Could not load XML file from "' . $location . '"');
674
-        return false;
674
+        return FALSE;
675 675
     }
676 676
 
677 677
     /**
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
 
696 696
         if ($preloadedDocument instanceof \SimpleXMLElement) {
697 697
             $this->xml = $preloadedDocument;
698
-            return true;
698
+            return TRUE;
699 699
         }
700
-        return false;
700
+        return FALSE;
701 701
     }
702 702
 
703 703
     /**
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
                     }
744 744
                 }
745 745
             }
746
-            $this->dmdSecLoaded = true;
746
+            $this->dmdSecLoaded = TRUE;
747 747
         }
748 748
         return $this->dmdSec;
749 749
     }
@@ -790,9 +790,9 @@  discard block
 block discarded – undo
790 790
                 !empty($extConf['fileGrpFulltext'])
791 791
                 && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== []
792 792
             ) {
793
-                $this->hasFulltext = true;
793
+                $this->hasFulltext = TRUE;
794 794
             }
795
-            $this->fileGrpsLoaded = true;
795
+            $this->fileGrpsLoaded = TRUE;
796 796
         }
797 797
         return $this->fileGrps;
798 798
     }
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
                     $this->physicalStructure = array_merge($physSeq, $elements);
882 882
                 }
883 883
             }
884
-            $this->physicalStructureLoaded = true;
884
+            $this->physicalStructureLoaded = TRUE;
885 885
         }
886 886
         return $this->physicalStructure;
887 887
     }
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
                     $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from;
901 901
                 }
902 902
             }
903
-            $this->smLinksLoaded = true;
903
+            $this->smLinksLoaded = TRUE;
904 904
         }
905 905
         return $this->smLinks;
906 906
     }
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
      * {@inheritDoc}
910 910
      * @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
911 911
      */
912
-    protected function _getThumbnail($forceReload = false)
912
+    protected function _getThumbnail($forceReload = FALSE)
913 913
     {
914 914
         if (
915 915
             !$this->thumbnailLoaded
@@ -919,14 +919,14 @@  discard block
 block discarded – undo
919 919
             $cPid = ($this->cPid ? $this->cPid : $this->pid);
920 920
             if (!$cPid) {
921 921
                 $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions');
922
-                $this->thumbnailLoaded = true;
922
+                $this->thumbnailLoaded = TRUE;
923 923
                 return $this->thumbnail;
924 924
             }
925 925
             // Load extension configuration.
926 926
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
927 927
             if (empty($extConf['fileGrpThumbs'])) {
928 928
                 $this->logger->warning('No fileGrp for thumbnails specified');
929
-                $this->thumbnailLoaded = true;
929
+                $this->thumbnailLoaded = TRUE;
930 930
                 return $this->thumbnail;
931 931
             }
932 932
             $strctId = $this->_getToplevelId();
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
             } else {
981 981
                 $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database');
982 982
             }
983
-            $this->thumbnailLoaded = true;
983
+            $this->thumbnailLoaded = TRUE;
984 984
         }
985 985
         return $this->thumbnail;
986 986
     }
@@ -1039,8 +1039,8 @@  discard block
 block discarded – undo
1039 1039
     public function __toString()
1040 1040
     {
1041 1041
         $xml = new \DOMDocument('1.0', 'utf-8');
1042
-        $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true));
1043
-        $xml->formatOutput = true;
1042
+        $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE));
1043
+        $xml->formatOutput = TRUE;
1044 1044
         return $xml->saveXML();
1045 1045
     }
1046 1046
 
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
     public function __wakeup()
1056 1056
     {
1057 1057
         $xml = Helper::getXmlFileAsString($this->asXML);
1058
-        if ($xml !== false) {
1058
+        if ($xml !== FALSE) {
1059 1059
             $this->asXML = '';
1060 1060
             $this->xml = $xml;
1061 1061
             // Rebuild the unserializable properties.
Please login to merge, or discard this patch.
Classes/Common/SolrSearchResult/ResultDocument.php 2 patches
Braces   +19 added lines, -38 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
  * @subpackage dlf
25 25
  * @access public
26 26
  */
27
-class ResultDocument
28
-{
27
+class ResultDocument {
29 28
 
30 29
     /**
31 30
      * The identifier
@@ -134,8 +133,7 @@  discard block
 block discarded – undo
134 133
      *
135 134
      * @return void
136 135
      */
137
-    public function __construct($record, $highlighting, $fields)
138
-    {
136
+    public function __construct($record, $highlighting, $fields) {
139 137
         $this->id = $record[$fields['id']];
140 138
         $this->uid = $record[$fields['uid']];
141 139
         $this->page = $record[$fields['page']];
@@ -160,8 +158,7 @@  discard block
 block discarded – undo
160 158
      *
161 159
      * @return string The result's record identifier
162 160
      */
163
-    public function getId()
164
-    {
161
+    public function getId() {
165 162
         return $this->id;
166 163
     }
167 164
 
@@ -172,8 +169,7 @@  discard block
 block discarded – undo
172 169
      *
173 170
      * @return string|null The result's record unified identifier
174 171
      */
175
-    public function getUid()
176
-    {
172
+    public function getUid() {
177 173
         return $this->uid;
178 174
     }
179 175
 
@@ -184,8 +180,7 @@  discard block
 block discarded – undo
184 180
      *
185 181
      * @return int The result's record page
186 182
      */
187
-    public function getPage()
188
-    {
183
+    public function getPage() {
189 184
         return $this->page;
190 185
     }
191 186
 
@@ -196,8 +191,7 @@  discard block
 block discarded – undo
196 191
      *
197 192
      * @return string All result's record snippets imploded to one string
198 193
      */
199
-    public function getSnippets()
200
-    {
194
+    public function getSnippets() {
201 195
         return $this->snippets;
202 196
     }
203 197
 
@@ -208,8 +202,7 @@  discard block
 block discarded – undo
208 202
      *
209 203
      * @return string
210 204
      */
211
-    public function getThumbnail()
212
-    {
205
+    public function getThumbnail() {
213 206
         return $this->thumbnail;
214 207
     }
215 208
 
@@ -220,8 +213,7 @@  discard block
 block discarded – undo
220 213
      *
221 214
      * @return string
222 215
      */
223
-    public function getTitle()
224
-    {
216
+    public function getTitle() {
225 217
         return $this->title;
226 218
     }
227 219
 
@@ -232,8 +224,7 @@  discard block
 block discarded – undo
232 224
      *
233 225
      * @return boolean
234 226
      */
235
-    public function getToplevel()
236
-    {
227
+    public function getToplevel() {
237 228
         return $this->toplevel;
238 229
     }
239 230
 
@@ -244,8 +235,7 @@  discard block
 block discarded – undo
244 235
      *
245 236
      * @return string
246 237
      */
247
-    public function getType()
248
-    {
238
+    public function getType() {
249 239
         return $this->type;
250 240
     }
251 241
 
@@ -256,8 +246,7 @@  discard block
 block discarded – undo
256 246
      *
257 247
      * @return array(Page) All result's pages which contain search phrase
258 248
      */
259
-    public function getPages()
260
-    {
249
+    public function getPages() {
261 250
         return $this->pages;
262 251
     }
263 252
 
@@ -268,8 +257,7 @@  discard block
 block discarded – undo
268 257
      *
269 258
      * @return array(Region) All result's regions which contain search phrase
270 259
      */
271
-    public function getRegions()
272
-    {
260
+    public function getRegions() {
273 261
         return $this->regions;
274 262
     }
275 263
 
@@ -280,8 +268,7 @@  discard block
 block discarded – undo
280 268
      *
281 269
      * @return array(Highlight) All result's highlights of search phrase
282 270
      */
283
-    public function getHighlights()
284
-    {
271
+    public function getHighlights() {
285 272
         return $this->highlights;
286 273
     }
287 274
 
@@ -292,8 +279,7 @@  discard block
 block discarded – undo
292 279
      *
293 280
      * @return array(string) All result's highlights of search phrase
294 281
      */
295
-    public function getHighlightsIds()
296
-    {
282
+    public function getHighlightsIds() {
297 283
         $highlightsIds = [];
298 284
         foreach ($this->highlights as $highlight) {
299 285
             array_push($highlightsIds, $highlight->getId());
@@ -309,8 +295,7 @@  discard block
 block discarded – undo
309 295
      *
310 296
      * @return void
311 297
      */
312
-    private function parseSnippets()
313
-    {
298
+    private function parseSnippets() {
314 299
         $snippetArray = $this->getArrayByIndex('text');
315 300
 
316 301
         $this->snippets = !empty($snippetArray) ? implode(' [...] ', $snippetArray) : '';
@@ -324,8 +309,7 @@  discard block
 block discarded – undo
324 309
      *
325 310
      * @return void
326 311
      */
327
-    private function parsePages()
328
-    {
312
+    private function parsePages() {
329 313
         $pageArray = $this->getArrayByIndex('pages');
330 314
 
331 315
         $i = 0;
@@ -345,8 +329,7 @@  discard block
 block discarded – undo
345 329
      *
346 330
      * @return void
347 331
      */
348
-    private function parseRegions()
349
-    {
332
+    private function parseRegions() {
350 333
         $regionArray = $this->getArrayByIndex('regions');
351 334
 
352 335
         $i = 0;
@@ -366,8 +349,7 @@  discard block
 block discarded – undo
366 349
      *
367 350
      * @return void
368 351
      */
369
-    private function parseHighlights()
370
-    {
352
+    private function parseHighlights() {
371 353
         $highlightArray = $this->getArrayByIndex('highlights');
372 354
 
373 355
         foreach ($highlightArray as $highlights) {
@@ -388,8 +370,7 @@  discard block
 block discarded – undo
388 370
      *
389 371
      * @return array
390 372
      */
391
-    private function getArrayByIndex($index)
392
-    {
373
+    private function getArrayByIndex($index) {
393 374
         $objectArray = [];
394 375
         foreach ($this->snippetsForRecord as $snippet) {
395 376
             if (!empty($snippet[$index])) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
      * @var boolean
82 82
      * @access private
83 83
      */
84
-    private $toplevel = false;
84
+    private $toplevel = FALSE;
85 85
 
86 86
     /**
87 87
      * The structure type
Please login to merge, or discard this patch.
Classes/Common/Indexer.php 3 patches
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
  * @subpackage dlf
33 33
  * @access public
34 34
  */
35
-class Indexer
36
-{
35
+class Indexer {
37 36
     /**
38 37
      * The extension key
39 38
      *
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
      *
94 93
      * @return bool true on success or false on failure
95 94
      */
96
-    public static function add(Document $document)
97
-    {
95
+    public static function add(Document $document) {
98 96
         if (in_array($document->getUid(), self::$processedDocs)) {
99 97
             return true;
100 98
         } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) {
@@ -209,8 +207,7 @@  discard block
 block discarded – undo
209 207
      *
210 208
      * @return string The field's dynamic index name
211 209
      */
212
-    public static function getIndexFieldName($index_name, $pid = 0)
213
-    {
210
+    public static function getIndexFieldName($index_name, $pid = 0) {
214 211
         // Sanitize input.
215 212
         $pid = max(intval($pid), 0);
216 213
         if (!$pid) {
@@ -236,8 +233,7 @@  discard block
 block discarded – undo
236 233
      *
237 234
      * @return void
238 235
      */
239
-    protected static function loadIndexConf($pid)
240
-    {
236
+    protected static function loadIndexConf($pid) {
241 237
         if (!self::$fieldsLoaded) {
242 238
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
243 239
                 ->getQueryBuilderForTable('tx_dlf_metadata');
@@ -307,8 +303,7 @@  discard block
 block discarded – undo
307 303
      *
308 304
      * @return bool true on success or false on failure
309 305
      */
310
-    protected static function processLogical(Document $document, array $logicalUnit)
311
-    {
306
+    protected static function processLogical(Document $document, array $logicalUnit) {
312 307
         $success = true;
313 308
         $doc = $document->getDoc();
314 309
         $doc->cPid = $document->getPid();
@@ -436,8 +431,7 @@  discard block
 block discarded – undo
436 431
      *
437 432
      * @return bool true on success or false on failure
438 433
      */
439
-    protected static function processPhysical(Document $document, $page, array $physicalUnit)
440
-    {
434
+    protected static function processPhysical(Document $document, $page, array $physicalUnit) {
441 435
         $doc = $document->getDoc();
442 436
         $doc->cPid = $document->getPid();
443 437
         if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) {
@@ -525,8 +519,7 @@  discard block
 block discarded – undo
525 519
      *
526 520
      * @return bool true on success or false on failure
527 521
      */
528
-    protected static function solrConnect($core, $pid = 0)
529
-    {
522
+    protected static function solrConnect($core, $pid = 0) {
530 523
         // Get Solr instance.
531 524
         if (!self::$solr) {
532 525
             // Connect to Solr server.
@@ -549,8 +542,7 @@  discard block
 block discarded – undo
549 542
      *
550 543
      * @access private
551 544
      */
552
-    private function __construct()
553
-    {
545
+    private function __construct() {
554 546
         // This is a static class, thus no instances should be created.
555 547
     }
556 548
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                         $parent->setDoc($doc);
116 116
                         $success = self::add($parent);
117 117
                     } else {
118
-                        Helper::log('Could not load parent document with UID ' . $document->getDoc()->parentId, LOG_SEVERITY_ERROR);
118
+                        Helper::log('Could not load parent document with UID '.$document->getDoc()->parentId, LOG_SEVERITY_ERROR);
119 119
                         return false;
120 120
                     }
121 121
                 }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 self::$processedDocs[] = $document->getUid();
126 126
                 // Delete old Solr documents.
127 127
                 $updateQuery = self::$solr->service->createUpdate();
128
-                $updateQuery->addDeleteQuery('uid:' . $document->getUid());
128
+                $updateQuery->addDeleteQuery('uid:'.$document->getUid());
129 129
                 self::$solr->service->update($updateQuery);
130 130
 
131 131
                 // Index every logical unit as separate Solr document.
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
             } catch (\Exception $e) {
175 175
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
176 176
                     Helper::addMessage(
177
-                        Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()),
177
+                        Helper::getLanguageService()->getLL('flash.solrException').' '.htmlspecialchars($e->getMessage()),
178 178
                         Helper::getLanguageService()->getLL('flash.error'),
179 179
                         FlashMessage::ERROR,
180 180
                         true,
181 181
                         'core.template.flashMessages'
182 182
                     );
183 183
                 }
184
-                Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
184
+                Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR);
185 185
                 return false;
186 186
             }
187 187
         } else {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         // Sanitize input.
215 215
         $pid = max(intval($pid), 0);
216 216
         if (!$pid) {
217
-            Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR);
217
+            Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR);
218 218
             return '';
219 219
         }
220 220
         // Load metadata configuration.
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u');
224 224
         $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u');
225 225
         $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u');
226
-        $index_name .= '_' . $suffix;
226
+        $index_name .= '_'.$suffix;
227 227
         return $index_name;
228 228
     }
229 229
 
@@ -356,11 +356,11 @@  discard block
 block discarded – undo
356 356
                     $solrDoc->setField(self::getIndexFieldName($index_name, $document->getPid()), $data, self::$fields['fieldboost'][$index_name]);
357 357
                     if (in_array($index_name, self::$fields['sortables'])) {
358 358
                         // Add sortable fields to index.
359
-                        $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]);
359
+                        $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]);
360 360
                     }
361 361
                     if (in_array($index_name, self::$fields['facets'])) {
362 362
                         // Add facets to index.
363
-                        $solrDoc->setField($index_name . '_faceting', $data);
363
+                        $solrDoc->setField($index_name.'_faceting', $data);
364 364
                     }
365 365
                     if (in_array($index_name, self::$fields['autocomplete'])) {
366 366
                         $autocomplete = array_merge($autocomplete, $data);
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
             } catch (\Exception $e) {
386 386
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
387 387
                     Helper::addMessage(
388
-                        Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()),
388
+                        Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()),
389 389
                         Helper::getLanguageService()->getLL('flash.error'),
390 390
                         FlashMessage::ERROR,
391 391
                         true,
392 392
                         'core.template.flashMessages'
393 393
                     );
394 394
                 }
395
-                Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
395
+                Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR);
396 396
                 return false;
397 397
             }
398 398
         }
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                                 $data = self::removeAppendsFromAuthor($data);
459 459
                             }
460 460
                             // Add facets to index.
461
-                            $solrDoc->setField($index_name . '_faceting', $data);
461
+                            $solrDoc->setField($index_name.'_faceting', $data);
462 462
                         }
463 463
                     }
464 464
                 }
@@ -476,14 +476,14 @@  discard block
 block discarded – undo
476 476
             } catch (\Exception $e) {
477 477
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
478 478
                     Helper::addMessage(
479
-                        Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()),
479
+                        Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()),
480 480
                         Helper::getLanguageService()->getLL('flash.error'),
481 481
                         FlashMessage::ERROR,
482 482
                         true,
483 483
                         'core.template.flashMessages'
484 484
                     );
485 485
                 }
486
-                Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
486
+                Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR);
487 487
                 return false;
488 488
             }
489 489
         }
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     private static function getSolrDocument($updateQuery, $document, $unit, $fullText = '') {
535 535
         $solrDoc = $updateQuery->createDocument();
536 536
         // Create unique identifier from document's UID and unit's XML ID.
537
-        $solrDoc->setField('id', $document->getUid() . $unit['id']);
537
+        $solrDoc->setField('id', $document->getUid().$unit['id']);
538 538
         $solrDoc->setField('uid', $document->getUid());
539 539
         $solrDoc->setField('pid', $document->getPid());
540 540
         $solrDoc->setField('partof', $document->getPartof());
Please login to merge, or discard this patch.
Upper-Lower-Casing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @var bool
67 67
      * @access protected
68 68
      */
69
-    protected static $fieldsLoaded = false;
69
+    protected static $fieldsLoaded = FALSE;
70 70
 
71 71
     /**
72 72
      * List of already processed documents
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
     public static function add(Document $document)
97 97
     {
98 98
         if (in_array($document->getUid(), self::$processedDocs)) {
99
-            return true;
99
+            return TRUE;
100 100
         } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) {
101
-            $success = true;
101
+            $success = TRUE;
102 102
             Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf');
103 103
             // Handle multi-volume documents.
104 104
             if ($parentId = $document->getPartof()) {
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
                 $parent = $documentRepository->findByUid($parentId);
111 111
                 if ($parent) {
112 112
                     // get XML document of parent
113
-                    $doc = Doc::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], true);
114
-                    if ($doc !== null) {
113
+                    $doc = Doc::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], TRUE);
114
+                    if ($doc !== NULL) {
115 115
                         $parent->setDoc($doc);
116 116
                         $success = self::add($parent);
117 117
                     } else {
118 118
                         Helper::log('Could not load parent document with UID ' . $document->getDoc()->parentId, LOG_SEVERITY_ERROR);
119
-                        return false;
119
+                        return FALSE;
120 120
                     }
121 121
                 }
122 122
             }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                             sprintf(Helper::getLanguageService()->getLL('flash.documentIndexed'), $document->getTitle(), $document->getUid()),
158 158
                             Helper::getLanguageService()->getLL('flash.done'),
159 159
                             FlashMessage::OK,
160
-                            true,
160
+                            TRUE,
161 161
                             'core.template.flashMessages'
162 162
                         );
163 163
                     } else {
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                             sprintf(Helper::getLanguageService()->getLL('flash.documentNotIndexed'), $document->getTitle(), $document->getUid()),
166 166
                             Helper::getLanguageService()->getLL('flash.error'),
167 167
                             FlashMessage::ERROR,
168
-                            true,
168
+                            TRUE,
169 169
                             'core.template.flashMessages'
170 170
                         );
171 171
                     }
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
                         Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()),
178 178
                         Helper::getLanguageService()->getLL('flash.error'),
179 179
                         FlashMessage::ERROR,
180
-                        true,
180
+                        TRUE,
181 181
                         'core.template.flashMessages'
182 182
                     );
183 183
                 }
184 184
                 Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
185
-                return false;
185
+                return FALSE;
186 186
             }
187 187
         } else {
188 188
             if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
                     Helper::getLanguageService()->getLL('flash.solrNoConnection'),
191 191
                     Helper::getLanguageService()->getLL('flash.warning'),
192 192
                     FlashMessage::WARNING,
193
-                    true,
193
+                    TRUE,
194 194
                     'core.template.flashMessages'
195 195
                 );
196 196
             }
197 197
             Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR);
198
-            return false;
198
+            return FALSE;
199 199
         }
200 200
     }
201 201
 
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
                 if ($indexing['index_boost'] > 0.0) {
291 291
                     self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']);
292 292
                 } else {
293
-                    self::$fields['fieldboost'][$indexing['index_name']] = false;
293
+                    self::$fields['fieldboost'][$indexing['index_name']] = FALSE;
294 294
                 }
295 295
             }
296
-            self::$fieldsLoaded = true;
296
+            self::$fieldsLoaded = TRUE;
297 297
         }
298 298
     }
299 299
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      */
310 310
     protected static function processLogical(Document $document, array $logicalUnit)
311 311
     {
312
-        $success = true;
312
+        $success = TRUE;
313 313
         $doc = $document->getDoc();
314 314
         $doc->cPid = $document->getPid();
315 315
         // Get metadata for logical unit.
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
                 $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId']));
334 334
             }
335 335
             // There can be only one toplevel unit per UID, independently of backend configuration
336
-            $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false);
336
+            $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE);
337 337
             $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']);
338 338
             $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']);
339 339
             $solrDoc->setField('record_id', $metadata['record_id'][0]);
@@ -388,12 +388,12 @@  discard block
 block discarded – undo
388 388
                         Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()),
389 389
                         Helper::getLanguageService()->getLL('flash.error'),
390 390
                         FlashMessage::ERROR,
391
-                        true,
391
+                        TRUE,
392 392
                         'core.template.flashMessages'
393 393
                     );
394 394
                 }
395 395
                 Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
396
-                return false;
396
+                return FALSE;
397 397
             }
398 398
         }
399 399
         // Check for child elements...
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
                     break;
440 440
                 }
441 441
             }
442
-            $solrDoc->setField('toplevel', false);
442
+            $solrDoc->setField('toplevel', FALSE);
443 443
             $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']);
444 444
             $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']);
445 445
 
@@ -479,15 +479,15 @@  discard block
 block discarded – undo
479 479
                         Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()),
480 480
                         Helper::getLanguageService()->getLL('flash.error'),
481 481
                         FlashMessage::ERROR,
482
-                        true,
482
+                        TRUE,
483 483
                         'core.template.flashMessages'
484 484
                     );
485 485
                 }
486 486
                 Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
487
-                return false;
487
+                return FALSE;
488 488
             }
489 489
         }
490
-        return true;
490
+        return TRUE;
491 491
     }
492 492
 
493 493
     /**
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
                     self::loadIndexConf($pid);
514 514
                 }
515 515
             } else {
516
-                return false;
516
+                return FALSE;
517 517
             }
518 518
         }
519
-        return true;
519
+        return TRUE;
520 520
     }
521 521
 
522 522
     /**
Please login to merge, or discard this patch.
Classes/Common/Doc.php 3 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -569,14 +569,14 @@  discard block
 block discarded – undo
569 569
                     if ($fileContent !== false) {
570 570
                         $textFormat = $this->getTextFormat($fileContent);
571 571
                     } else {
572
-                        $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"');
572
+                        $this->logger->warning('Couldn\'t load full text file for structure node @ID "'.$id.'"');
573 573
                         return $fullText;
574 574
                     }
575 575
                     break;
576 576
                 }
577 577
             }
578 578
         } else {
579
-            $this->logger->warning('Invalid structure node @ID "' . $id . '"');
579
+            $this->logger->warning('Invalid structure node @ID "'.$id.'"');
580 580
             return $fullText;
581 581
         }
582 582
         // Is this text format supported?
@@ -595,12 +595,12 @@  discard block
 block discarded – undo
595 595
                     $textMiniOcr = $obj->getTextAsMiniOcr($ocrTextXml);
596 596
                     $this->rawTextArray[$id] = $textMiniOcr;
597 597
                 } else {
598
-                    $this->logger->warning('Invalid class/method "' . $class . '->getRawText()" for text format "' . $textFormat . '"');
598
+                    $this->logger->warning('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"');
599 599
                 }
600 600
             }
601 601
             $fullText = $textMiniOcr;
602 602
         } else {
603
-            $this->logger->warning('Unsupported text format "' . $textFormat . '" in physical node with @ID "' . $id . '"');
603
+            $this->logger->warning('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"');
604 604
         }
605 605
         return $fullText;
606 606
     }
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
                     $title = self::getTitle($partof, true);
675 675
                 }
676 676
             } else {
677
-                Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING);
677
+                Helper::log('No document with UID '.$uid.' found or document not accessible', LOG_SEVERITY_WARNING);
678 678
             }
679 679
         } else {
680
-            Helper::log('Invalid UID ' . $uid . ' for document', LOG_SEVERITY_ERROR);
680
+            Helper::log('Invalid UID '.$uid.' for document', LOG_SEVERITY_ERROR);
681 681
         }
682 682
         return $title;
683 683
     }
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
             // the actual loading is format specific
809 809
             return $this->loadLocation($location);
810 810
         } else {
811
-            $this->logger->error('Invalid file location "' . $location . '" for document loading');
811
+            $this->logger->error('Invalid file location "'.$location.'" for document loading');
812 812
         }
813 813
         return false;
814 814
     }
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
         // Set metadata definitions' PID.
950 950
         $cPid = ($this->cPid ? $this->cPid : $this->pid);
951 951
         if (!$cPid) {
952
-            $this->logger->error('Invalid PID ' . $cPid . ' for metadata definitions');
952
+            $this->logger->error('Invalid PID '.$cPid.' for metadata definitions');
953 953
             return [];
954 954
         }
955 955
         if (
@@ -1184,12 +1184,12 @@  discard block
 block discarded – undo
1184 1184
      */
1185 1185
     public function __get($var)
1186 1186
     {
1187
-        $method = '_get' . ucfirst($var);
1187
+        $method = '_get'.ucfirst($var);
1188 1188
         if (
1189 1189
             !property_exists($this, $var)
1190 1190
             || !method_exists($this, $method)
1191 1191
         ) {
1192
-            $this->logger->warning('There is no getter function for property "' . $var . '"');
1192
+            $this->logger->warning('There is no getter function for property "'.$var.'"');
1193 1193
             return;
1194 1194
         } else {
1195 1195
             return $this->$method();
@@ -1222,12 +1222,12 @@  discard block
 block discarded – undo
1222 1222
      */
1223 1223
     public function __set($var, $value)
1224 1224
     {
1225
-        $method = '_set' . ucfirst($var);
1225
+        $method = '_set'.ucfirst($var);
1226 1226
         if (
1227 1227
             !property_exists($this, $var)
1228 1228
             || !method_exists($this, $method)
1229 1229
         ) {
1230
-            $this->logger->warning('There is no setter function for property "' . $var . '"');
1230
+            $this->logger->warning('There is no setter function for property "'.$var.'"');
1231 1231
         } else {
1232 1232
             $this->$method($value);
1233 1233
         }
Please login to merge, or discard this patch.
Braces   +32 added lines, -64 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@  discard block
 block discarded – undo
49 49
  * @property-read string $toplevelId This holds the toplevel structure's "@ID" (METS) or the manifest's "@id" (IIIF)
50 50
  * @abstract
51 51
  */
52
-abstract class Doc
53
-{
52
+abstract class Doc {
54 53
     /**
55 54
      * This holds the logger
56 55
      *
@@ -326,8 +325,7 @@  discard block
 block discarded – undo
326 325
      *
327 326
      * @return void
328 327
      */
329
-    public static function clearRegistry()
330
-    {
328
+    public static function clearRegistry() {
331 329
         // Reset registry array.
332 330
         self::$registry = [];
333 331
     }
@@ -505,8 +503,7 @@  discard block
 block discarded – undo
505 503
      *
506 504
      * @return int The physical page number
507 505
      */
508
-    public function getPhysicalPage($logicalPage)
509
-    {
506
+    public function getPhysicalPage($logicalPage) {
510 507
         if (
511 508
             !empty($this->lastSearchedPhysicalPage['logicalPage'])
512 509
             && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage
@@ -551,8 +548,7 @@  discard block
 block discarded – undo
551 548
      *
552 549
      * @return string The OCR full text
553 550
      */
554
-    protected function getFullTextFromXml($id)
555
-    {
551
+    protected function getFullTextFromXml($id) {
556 552
         $fullText = '';
557 553
         // Load available text formats, ...
558 554
         $this->loadFormats();
@@ -614,8 +610,7 @@  discard block
 block discarded – undo
614 610
      *
615 611
      * @return string The format of the OCR full text
616 612
      */
617
-    private function getTextFormat($fileContent)
618
-    {
613
+    private function getTextFormat($fileContent) {
619 614
         $xml = Helper::getXmlFileAsString($fileContent);
620 615
 
621 616
         if ($xml !== false) {
@@ -638,8 +633,7 @@  discard block
 block discarded – undo
638 633
      *
639 634
      * @return string The title of the document itself or a parent document
640 635
      */
641
-    public static function getTitle($uid, $recursive = false)
642
-    {
636
+    public static function getTitle($uid, $recursive = false) {
643 637
         $title = '';
644 638
         // Sanitize input.
645 639
         $uid = max(intval($uid), 0);
@@ -691,8 +685,7 @@  discard block
 block discarded – undo
691 685
      *
692 686
      * @return array The logical structure node's / resource's parsed metadata array
693 687
      */
694
-    public function getTitledata($cPid = 0)
695
-    {
688
+    public function getTitledata($cPid = 0) {
696 689
         $titledata = $this->getMetadata($this->_getToplevelId(), $cPid);
697 690
         // Add information from METS structural map to titledata array.
698 691
         if ($this instanceof MetsDocument) {
@@ -725,8 +718,7 @@  discard block
 block discarded – undo
725 718
      * @return int|bool: false if structure with $logId is not a child of this substructure,
726 719
      * or the actual depth.
727 720
      */
728
-    protected function getTreeDepth($structure, $depth, $logId)
729
-    {
721
+    protected function getTreeDepth($structure, $depth, $logId) {
730 722
         foreach ($structure as $element) {
731 723
             if ($element['id'] == $logId) {
732 724
                 return $depth;
@@ -748,8 +740,7 @@  discard block
 block discarded – undo
748 740
      * @param string $logId: The id of the logical structure element whose depth is requested
749 741
      * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC.
750 742
      */
751
-    public function getStructureDepth($logId)
752
-    {
743
+    public function getStructureDepth($logId) {
753 744
         return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId);
754 745
     }
755 746
 
@@ -801,8 +792,7 @@  discard block
 block discarded – undo
801 792
      *
802 793
      * @return bool true on success or false on failure
803 794
      */
804
-    protected function load($location)
805
-    {
795
+    protected function load($location) {
806 796
         // Load XML / JSON-LD file.
807 797
         if (GeneralUtility::isValidUrl($location)) {
808 798
             // the actual loading is format specific
@@ -829,8 +819,7 @@  discard block
 block discarded – undo
829 819
      *
830 820
      * @return void
831 821
      */
832
-    protected function loadFormats()
833
-    {
822
+    protected function loadFormats() {
834 823
         if (!$this->formatsLoaded) {
835 824
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
836 825
                 ->getQueryBuilderForTable('tx_dlf_formats');
@@ -870,8 +859,7 @@  discard block
 block discarded – undo
870 859
      *
871 860
      * @return void
872 861
      */
873
-    public function registerNamespaces(&$obj)
874
-    {
862
+    public function registerNamespaces(&$obj) {
875 863
         // TODO Check usage. XML specific method does not seem to be used anywhere outside this class within the project, but it is public and may be used by extensions.
876 864
         $this->loadFormats();
877 865
         // Do we have a \SimpleXMLElement or \DOMXPath object?
@@ -896,8 +884,7 @@  discard block
 block discarded – undo
896 884
      *
897 885
      * @return int The PID of the metadata definitions
898 886
      */
899
-    protected function _getCPid()
900
-    {
887
+    protected function _getCPid() {
901 888
         return $this->cPid;
902 889
     }
903 890
 
@@ -908,8 +895,7 @@  discard block
 block discarded – undo
908 895
      *
909 896
      * @return bool Are there any fulltext files available?
910 897
      */
911
-    protected function _getHasFulltext()
912
-    {
898
+    protected function _getHasFulltext() {
913 899
         $this->ensureHasFulltextIsSet();
914 900
         return $this->hasFulltext;
915 901
     }
@@ -921,8 +907,7 @@  discard block
 block discarded – undo
921 907
      *
922 908
      * @return string The location of the document
923 909
      */
924
-    protected function _getLocation()
925
-    {
910
+    protected function _getLocation() {
926 911
         return $this->location;
927 912
     }
928 913
 
@@ -944,8 +929,7 @@  discard block
 block discarded – undo
944 929
      *
945 930
      * @return array Array of metadata with their corresponding logical structure node ID as key
946 931
      */
947
-    protected function _getMetadataArray()
948
-    {
932
+    protected function _getMetadataArray() {
949 933
         // Set metadata definitions' PID.
950 934
         $cPid = ($this->cPid ? $this->cPid : $this->pid);
951 935
         if (!$cPid) {
@@ -970,8 +954,7 @@  discard block
 block discarded – undo
970 954
      *
971 955
      * @return int The total number of pages and/or tracks
972 956
      */
973
-    protected function _getNumPages()
974
-    {
957
+    protected function _getNumPages() {
975 958
         $this->_getPhysicalStructure();
976 959
         return $this->numPages;
977 960
     }
@@ -983,8 +966,7 @@  discard block
 block discarded – undo
983 966
      *
984 967
      * @return int The UID of the parent document or zero if not applicable
985 968
      */
986
-    protected function _getParentId()
987
-    {
969
+    protected function _getParentId() {
988 970
         return $this->parentId;
989 971
     }
990 972
 
@@ -1007,8 +989,7 @@  discard block
 block discarded – undo
1007 989
      *
1008 990
      * @return array Array of elements' type, label and file representations ordered by "@ID" attribute / Canvas order
1009 991
      */
1010
-    protected function _getPhysicalStructureInfo()
1011
-    {
992
+    protected function _getPhysicalStructureInfo() {
1012 993
         // Is there no physical structure array yet?
1013 994
         if (!$this->physicalStructureLoaded) {
1014 995
             // Build physical structure array.
@@ -1024,8 +1005,7 @@  discard block
 block discarded – undo
1024 1005
      *
1025 1006
      * @return int The PID of the document or zero if not in database
1026 1007
      */
1027
-    protected function _getPid()
1028
-    {
1008
+    protected function _getPid() {
1029 1009
         return $this->pid;
1030 1010
     }
1031 1011
 
@@ -1036,8 +1016,7 @@  discard block
 block discarded – undo
1036 1016
      *
1037 1017
      * @return bool Is the document instantiated successfully?
1038 1018
      */
1039
-    protected function _getReady()
1040
-    {
1019
+    protected function _getReady() {
1041 1020
         return $this->ready;
1042 1021
     }
1043 1022
 
@@ -1048,8 +1027,7 @@  discard block
 block discarded – undo
1048 1027
      *
1049 1028
      * @return mixed The METS file's / IIIF manifest's record identifier
1050 1029
      */
1051
-    protected function _getRecordId()
1052
-    {
1030
+    protected function _getRecordId() {
1053 1031
         return $this->recordId;
1054 1032
     }
1055 1033
 
@@ -1060,8 +1038,7 @@  discard block
 block discarded – undo
1060 1038
      *
1061 1039
      * @return int The UID of the root document or zero if not applicable
1062 1040
      */
1063
-    protected function _getRootId()
1064
-    {
1041
+    protected function _getRootId() {
1065 1042
         if (!$this->rootIdLoaded) {
1066 1043
             if ($this->parentId) {
1067 1044
                 $parent = self::getInstance($this->parentId, ['storagePid' => $this->pid]);
@@ -1091,8 +1068,7 @@  discard block
 block discarded – undo
1091 1068
      *
1092 1069
      * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved
1093 1070
      */
1094
-    protected function _getTableOfContents()
1095
-    {
1071
+    protected function _getTableOfContents() {
1096 1072
         // Is there no logical structure array yet?
1097 1073
         if (!$this->tableOfContentsLoaded) {
1098 1074
             // Get all logical structures.
@@ -1133,8 +1109,7 @@  discard block
 block discarded – undo
1133 1109
      *
1134 1110
      * @return mixed The UID or the URL of the document
1135 1111
      */
1136
-    protected function _getUid()
1137
-    {
1112
+    protected function _getUid() {
1138 1113
         return $this->uid;
1139 1114
     }
1140 1115
 
@@ -1147,8 +1122,7 @@  discard block
 block discarded – undo
1147 1122
      *
1148 1123
      * @return void
1149 1124
      */
1150
-    protected function _setCPid($value)
1151
-    {
1125
+    protected function _setCPid($value) {
1152 1126
         $this->cPid = max(intval($value), 0);
1153 1127
     }
1154 1128
 
@@ -1165,8 +1139,7 @@  discard block
 block discarded – undo
1165 1139
      *
1166 1140
      * @return void
1167 1141
      */
1168
-    protected function __construct($location, $pid, $preloadedDocument)
1169
-    {
1142
+    protected function __construct($location, $pid, $preloadedDocument) {
1170 1143
         $this->setPreloadedDocument($preloadedDocument);
1171 1144
         $this->init($location);
1172 1145
         $this->establishRecordId($pid);
@@ -1182,8 +1155,7 @@  discard block
 block discarded – undo
1182 1155
      *
1183 1156
      * @return mixed Value of $this->$var
1184 1157
      */
1185
-    public function __get($var)
1186
-    {
1158
+    public function __get($var) {
1187 1159
         $method = '_get' . ucfirst($var);
1188 1160
         if (
1189 1161
             !property_exists($this, $var)
@@ -1205,8 +1177,7 @@  discard block
 block discarded – undo
1205 1177
      *
1206 1178
      * @return bool true if variable is set and not empty, false otherwise
1207 1179
      */
1208
-    public function __isset($var)
1209
-    {
1180
+    public function __isset($var) {
1210 1181
         return !empty($this->__get($var));
1211 1182
     }
1212 1183
 
@@ -1220,8 +1191,7 @@  discard block
 block discarded – undo
1220 1191
      *
1221 1192
      * @return void
1222 1193
      */
1223
-    public function __set($var, $value)
1224
-    {
1194
+    public function __set($var, $value) {
1225 1195
         $method = '_set' . ucfirst($var);
1226 1196
         if (
1227 1197
             !property_exists($this, $var)
@@ -1239,8 +1209,7 @@  discard block
 block discarded – undo
1239 1209
      * @param string $location
1240 1210
      * @return Doc|false
1241 1211
      */
1242
-    private static function getDocCache(string $location)
1243
-    {
1212
+    private static function getDocCache(string $location) {
1244 1213
         $cacheIdentifier = md5($location);
1245 1214
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc');
1246 1215
         $cacheHit = $cache->get($cacheIdentifier);
@@ -1255,8 +1224,7 @@  discard block
 block discarded – undo
1255 1224
      * @param Doc $doc
1256 1225
      * @return void
1257 1226
      */
1258
-    private static function setDocCache(string $location, Doc $doc)
1259
-    {
1227
+    private static function setDocCache(string $location, Doc $doc) {
1260 1228
         $cacheIdentifier = md5($location);
1261 1229
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc');
1262 1230
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @var bool
105 105
      * @access protected
106 106
      */
107
-    protected $formatsLoaded = false;
107
+    protected $formatsLoaded = FALSE;
108 108
 
109 109
     /**
110 110
      * Are there any fulltext files available? This also includes IIIF text annotations
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @var bool
115 115
      * @access protected
116 116
      */
117
-    protected $hasFulltext = false;
117
+    protected $hasFulltext = FALSE;
118 118
 
119 119
     /**
120 120
      * Last searched logical and physical page
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @var array
123 123
      * @access protected
124 124
      */
125
-    protected $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null];
125
+    protected $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL];
126 126
 
127 127
     /**
128 128
      * This holds the logical units
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      * @var bool
149 149
      * @access protected
150 150
      */
151
-    protected $metadataArrayLoaded = false;
151
+    protected $metadataArrayLoaded = FALSE;
152 152
 
153 153
     /**
154 154
      * The holds the total number of pages
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      * @var bool
190 190
      * @access protected
191 191
      */
192
-    protected $physicalStructureLoaded = false;
192
+    protected $physicalStructureLoaded = FALSE;
193 193
 
194 194
     /**
195 195
      * This holds the PID of the document or zero if not in database
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      * @var bool
215 215
      * @access protected
216 216
      */
217
-    protected $ready = false;
217
+    protected $ready = FALSE;
218 218
 
219 219
     /**
220 220
      * The METS file's / IIIF manifest's record identifier
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @var bool
249 249
      * @access protected
250 250
      */
251
-    protected $rootIdLoaded = false;
251
+    protected $rootIdLoaded = FALSE;
252 252
 
253 253
     /**
254 254
      * This holds the smLinks between logical and physical structMap
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      * @var bool
266 266
      * @access protected
267 267
      */
268
-    protected $smLinksLoaded = false;
268
+    protected $smLinksLoaded = FALSE;
269 269
 
270 270
     /**
271 271
      * This holds the logical structure
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * @var bool
283 283
      * @access protected
284 284
      */
285
-    protected $tableOfContentsLoaded = false;
285
+    protected $tableOfContentsLoaded = FALSE;
286 286
 
287 287
     /**
288 288
      * This holds the document's thumbnail location
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      * @var bool
300 300
      * @access protected
301 301
      */
302
-    protected $thumbnailLoaded = false;
302
+    protected $thumbnailLoaded = FALSE;
303 303
 
304 304
     /**
305 305
      * This holds the toplevel structure's "@ID" (METS) or the manifest's "@id" (IIIF)
@@ -408,17 +408,17 @@  discard block
 block discarded – undo
408 408
      *
409 409
      * @return \Kitodo\Dlf\Common\Doc|null Instance of this class, either MetsDocument or IiifManifest
410 410
      */
411
-    public static function &getInstance($location, $settings = [], $forceReload = false)
411
+    public static function &getInstance($location, $settings = [], $forceReload = FALSE)
412 412
     {
413 413
         // Create new instance depending on format (METS or IIIF) ...
414
-        $documentFormat = null;
415
-        $xml = null;
416
-        $iiif = null;
414
+        $documentFormat = NULL;
415
+        $xml = NULL;
416
+        $iiif = NULL;
417 417
 
418 418
         if ($instance = self::getDocCache($location)) {
419 419
             return $instance;
420 420
         } else {
421
-            $instance = null;
421
+            $instance = NULL;
422 422
         }
423 423
 
424 424
         // Try to load a file from the url
@@ -427,17 +427,17 @@  discard block
 block discarded – undo
427 427
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
428 428
 
429 429
             $content = Helper::getUrl($location);
430
-            if ($content !== false) {
430
+            if ($content !== FALSE) {
431 431
                 $xml = Helper::getXmlFileAsString($content);
432
-                if ($xml !== false) {
432
+                if ($xml !== FALSE) {
433 433
                     /* @var $xml \SimpleXMLElement */
434 434
                     $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/');
435 435
                     $xpathResult = $xml->xpath('//mets:mets');
436
-                    $documentFormat = !empty($xpathResult) ? 'METS' : null;
436
+                    $documentFormat = !empty($xpathResult) ? 'METS' : NULL;
437 437
                 } else {
438 438
                     // Try to load file as IIIF resource instead.
439
-                    $contentAsJsonArray = json_decode($content, true);
440
-                    if ($contentAsJsonArray !== null) {
439
+                    $contentAsJsonArray = json_decode($content, TRUE);
440
+                    if ($contentAsJsonArray !== NULL) {
441 441
                         IiifHelper::setUrlReader(IiifUrlReader::getInstance());
442 442
                         IiifHelper::setMaxThumbnailHeight($extConf['iiifThumbnailHeight']);
443 443
                         IiifHelper::setMaxThumbnailWidth($extConf['iiifThumbnailWidth']);
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
      *
479 479
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
480 480
      */
481
-    public abstract function getLogicalStructure($id, $recursive = false);
481
+    public abstract function getLogicalStructure($id, $recursive = FALSE);
482 482
 
483 483
     /**
484 484
      * This extracts all the metadata for a logical structure node
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         } else {
516 516
             $physicalPage = 0;
517 517
             foreach ($this->physicalStructureInfo as $page) {
518
-                if (strpos($page['orderlabel'], $logicalPage) !== false) {
518
+                if (strpos($page['orderlabel'], $logicalPage) !== FALSE) {
519 519
                     $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage;
520 520
                     $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage;
521 521
                     return $physicalPage;
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                 if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) {
567 567
                     // Get full text file.
568 568
                     $fileContent = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext]));
569
-                    if ($fileContent !== false) {
569
+                    if ($fileContent !== FALSE) {
570 570
                         $textFormat = $this->getTextFormat($fileContent);
571 571
                     } else {
572 572
                         $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"');
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     {
619 619
         $xml = Helper::getXmlFileAsString($fileContent);
620 620
 
621
-        if ($xml !== false) {
621
+        if ($xml !== FALSE) {
622 622
             // Get the root element's name as text format.
623 623
             return strtoupper($xml->getName());
624 624
         } else {
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
      *
639 639
      * @return string The title of the document itself or a parent document
640 640
      */
641
-    public static function getTitle($uid, $recursive = false)
641
+    public static function getTitle($uid, $recursive = FALSE)
642 642
     {
643 643
         $title = '';
644 644
         // Sanitize input.
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
                     && intval($partof)
672 672
                     && $partof != $uid
673 673
                 ) {
674
-                    $title = self::getTitle($partof, true);
674
+                    $title = self::getTitle($partof, TRUE);
675 675
                 }
676 676
             } else {
677 677
                 Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING);
@@ -732,12 +732,12 @@  discard block
 block discarded – undo
732 732
                 return $depth;
733 733
             } elseif (array_key_exists('children', $element)) {
734 734
                 $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId);
735
-                if ($foundInChildren !== false) {
735
+                if ($foundInChildren !== FALSE) {
736 736
                     return $foundInChildren;
737 737
                 }
738 738
             }
739 739
         }
740
-        return false;
740
+        return FALSE;
741 741
     }
742 742
 
743 743
     /**
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
         } else {
811 811
             $this->logger->error('Invalid file location "' . $location . '" for document loading');
812 812
         }
813
-        return false;
813
+        return FALSE;
814 814
     }
815 815
 
816 816
     /**
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
                     'class' => $resArray['class']
858 858
                 ];
859 859
             }
860
-            $this->formatsLoaded = true;
860
+            $this->formatsLoaded = TRUE;
861 861
         }
862 862
     }
863 863
 
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
         ) {
959 959
             $this->prepareMetadataArray($cPid);
960 960
             $this->metadataArray[0] = $cPid;
961
-            $this->metadataArrayLoaded = true;
961
+            $this->metadataArrayLoaded = TRUE;
962 962
         }
963 963
         return $this->metadataArray;
964 964
     }
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
                 $parent = self::getInstance($this->parentId, ['storagePid' => $this->pid]);
1068 1068
                 $this->rootId = $parent->rootId;
1069 1069
             }
1070
-            $this->rootIdLoaded = true;
1070
+            $this->rootIdLoaded = TRUE;
1071 1071
         }
1072 1072
         return $this->rootId;
1073 1073
     }
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
         // Is there no logical structure array yet?
1097 1097
         if (!$this->tableOfContentsLoaded) {
1098 1098
             // Get all logical structures.
1099
-            $this->getLogicalStructure('', true);
1100
-            $this->tableOfContentsLoaded = true;
1099
+            $this->getLogicalStructure('', TRUE);
1100
+            $this->tableOfContentsLoaded = TRUE;
1101 1101
         }
1102 1102
         return $this->tableOfContents;
1103 1103
     }
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
      *
1114 1114
      * @return string The document's thumbnail location
1115 1115
      */
1116
-    protected abstract function _getThumbnail($forceReload = false);
1116
+    protected abstract function _getThumbnail($forceReload = FALSE);
1117 1117
 
1118 1118
     /**
1119 1119
      * This returns the ID of the toplevel logical structure node
Please login to merge, or discard this patch.
Classes/Common/Helper.php 3 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) {
143 143
                     return false;
144 144
                 } elseif ($checksum == 10) {
145
-                    return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
145
+                    return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD');
146 146
                 } elseif (substr($id, -1, 1) != $checksum) {
147 147
                     return false;
148 148
                 }
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
308 308
         // Merge initialisation vector and encrypted data.
309 309
         if ($encrypted !== false) {
310
-            $encrypted = base64_encode($iv . $encrypted);
310
+            $encrypted = base64_encode($iv.$encrypted);
311 311
         }
312 312
         return $encrypted;
313 313
     }
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
     public static function getHookObjects($scriptRelPath)
362 362
     {
363 363
         $hookObjects = [];
364
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
365
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
364
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) {
365
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) {
366 366
                 $hookObjects[] = GeneralUtility::makeInstance($classRef);
367 367
             }
368 368
         }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
             !$uid
389 389
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
390 390
         ) {
391
-            self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR);
391
+            self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR);
392 392
             return '';
393 393
         }
394 394
 
@@ -399,15 +399,15 @@  discard block
 block discarded – undo
399 399
         // Should we check for a specific PID, too?
400 400
         if ($pid !== -1) {
401 401
             $pid = max(intval($pid), 0);
402
-            $where = $queryBuilder->expr()->eq($table . '.pid', $pid);
402
+            $where = $queryBuilder->expr()->eq($table.'.pid', $pid);
403 403
         }
404 404
 
405 405
         // Get index_name from database.
406 406
         $result = $queryBuilder
407
-            ->select($table . '.index_name AS index_name')
407
+            ->select($table.'.index_name AS index_name')
408 408
             ->from($table)
409 409
             ->where(
410
-                $queryBuilder->expr()->eq($table . '.uid', $uid),
410
+                $queryBuilder->expr()->eq($table.'.uid', $uid),
411 411
                 $where,
412 412
                 self::whereExpression($table)
413 413
             )
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         if ($resArray = $result->fetch()) {
418 418
             return $resArray['index_name'];
419 419
         } else {
420
-            self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING);
420
+            self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING);
421 421
             return '';
422 422
         }
423 423
     }
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
         // Analyze code and set appropriate ISO table.
437 437
         $isoCode = strtolower(trim($code));
438 438
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
439
-            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-2b.xml';
439
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-2b.xml';
440 440
         } elseif (preg_match('/^[a-z]{2}$/', $isoCode)) {
441
-            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-1.xml';
441
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-1.xml';
442 442
         } else {
443 443
             // No ISO code, return unchanged.
444 444
             return $code;
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
                 $lang = $languageService->getLLL($isoCode, $iso639);
457 457
             }
458 458
         } else {
459
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
459
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
460 460
             return $code;
461 461
         }
462 462
         if (!empty($lang)) {
463 463
             return $lang;
464 464
         } else {
465
-            self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
465
+            self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
466 466
             return $code;
467 467
         }
468 468
     }
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
             '-' => 39,
558 558
             ':' => 17,
559 559
         ];
560
-        $urn = strtolower($base . $id);
560
+        $urn = strtolower($base.$id);
561 561
         if (preg_match('/[^a-z0-9:-]/', $urn)) {
562 562
             self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING);
563 563
             return '';
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
             $checksum += ($i + 1) * intval(substr($digits, $i, 1));
572 572
         }
573 573
         $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1);
574
-        return $base . $id . $checksum;
574
+        return $base.$id.$checksum;
575 575
     }
576 576
 
577 577
     /**
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         // Sanitize input.
666 666
         $pid = max(intval($pid), 0);
667 667
         if (!$pid) {
668
-            self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING);
668
+            self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING);
669 669
             return $index_name;
670 670
         }
671 671
         /** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageRepository */
@@ -687,13 +687,13 @@  discard block
 block discarded – undo
687 687
         // First fetch the uid of the received index_name
688 688
         $result = $queryBuilder
689 689
             ->select(
690
-                $table . '.uid AS uid',
691
-                $table . '.l18n_parent AS l18n_parent'
690
+                $table.'.uid AS uid',
691
+                $table.'.l18n_parent AS l18n_parent'
692 692
             )
693 693
             ->from($table)
694 694
             ->where(
695
-                $queryBuilder->expr()->eq($table . '.pid', $pid),
696
-                $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
695
+                $queryBuilder->expr()->eq($table.'.pid', $pid),
696
+                $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)),
697 697
                 self::whereExpression($table, true)
698 698
             )
699 699
             ->setMaxResults(1)
@@ -706,12 +706,12 @@  discard block
 block discarded – undo
706 706
             $resArray = $allResults[0];
707 707
 
708 708
             $result = $queryBuilder
709
-                ->select($table . '.index_name AS index_name')
709
+                ->select($table.'.index_name AS index_name')
710 710
                 ->from($table)
711 711
                 ->where(
712
-                    $queryBuilder->expr()->eq($table . '.pid', $pid),
713
-                    $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
714
-                    $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())),
712
+                    $queryBuilder->expr()->eq($table.'.pid', $pid),
713
+                    $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']),
714
+                    $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())),
715 715
                     self::whereExpression($table, true)
716 716
                 )
717 717
                 ->setMaxResults(1)
@@ -729,14 +729,14 @@  discard block
 block discarded – undo
729 729
         if (empty($labels[$table][$pid][$languageAspect->getContentId()][$index_name])) {
730 730
             // Check if this table is allowed for translation.
731 731
             if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) {
732
-                $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]);
732
+                $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]);
733 733
                 if ($languageAspect->getContentId() > 0) {
734 734
                     $additionalWhere = $queryBuilder->expr()->andX(
735 735
                         $queryBuilder->expr()->orX(
736
-                            $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]),
737
-                            $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId()))
736
+                            $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]),
737
+                            $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId()))
738 738
                         ),
739
-                        $queryBuilder->expr()->eq($table . '.l18n_parent', 0)
739
+                        $queryBuilder->expr()->eq($table.'.l18n_parent', 0)
740 740
                     );
741 741
                 }
742 742
 
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
                     ->select('*')
746 746
                     ->from($table)
747 747
                     ->where(
748
-                        $queryBuilder->expr()->eq($table . '.pid', $pid),
748
+                        $queryBuilder->expr()->eq($table.'.pid', $pid),
749 749
                         $additionalWhere,
750 750
                         self::whereExpression($table, true)
751 751
                     )
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
                         }
764 764
                     }
765 765
                 } else {
766
-                    self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE);
766
+                    self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE);
767 767
                 }
768 768
             } else {
769
-                self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING);
769
+                self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING);
770 770
             }
771 771
         }
772 772
 
@@ -808,9 +808,9 @@  discard block
 block discarded – undo
808 808
             return GeneralUtility::makeInstance(ConnectionPool::class)
809 809
                 ->getQueryBuilderForTable($table)
810 810
                 ->expr()
811
-                ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
811
+                ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
812 812
         } else {
813
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
813
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
814 814
             return '1=-1';
815 815
         }
816 816
     }
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
      */
850 850
     public static function polyfillExtbaseClassesForTYPO3v9()
851 851
     {
852
-        $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php';
852
+        $classes = require __DIR__.'/../../Configuration/Extbase/Persistence/Classes.php';
853 853
 
854 854
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
855 855
         $configurationManager = $objectManager->get(ConfigurationManager::class);
Please login to merge, or discard this patch.
Braces   +24 added lines, -48 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
  * @subpackage dlf
32 32
  * @access public
33 33
  */
34
-class Helper
35
-{
34
+class Helper {
36 35
     /**
37 36
      * The extension key
38 37
      *
@@ -80,8 +79,7 @@  discard block
 block discarded – undo
80 79
      *
81 80
      * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
82 81
      */
83
-    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
84
-    {
82
+    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') {
85 83
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
86 84
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
87 85
         $flashMessage = GeneralUtility::makeInstance(
@@ -106,8 +104,7 @@  discard block
 block discarded – undo
106 104
      *
107 105
      * @return bool Is $id a valid GNL identifier of the given $type?
108 106
      */
109
-    public static function checkIdentifier($id, $type)
110
-    {
107
+    public static function checkIdentifier($id, $type) {
111 108
         $digits = substr($id, 0, 8);
112 109
         $checksum = 0;
113 110
         for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
@@ -171,8 +168,7 @@  discard block
 block discarded – undo
171 168
      *
172 169
      * @return mixed The decrypted value or false on error
173 170
      */
174
-    public static function decrypt($encrypted)
175
-    {
171
+    public static function decrypt($encrypted) {
176 172
         if (
177 173
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
178 174
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -211,8 +207,7 @@  discard block
 block discarded – undo
211 207
      *
212 208
      * @return \SimpleXMLElement|false
213 209
      */
214
-    public static function getXmlFileAsString($content)
215
-    {
210
+    public static function getXmlFileAsString($content) {
216 211
         // Don't make simplexml_load_string throw (when $content is an array
217 212
         // or object)
218 213
         if (!is_string($content)) {
@@ -243,8 +238,7 @@  discard block
 block discarded – undo
243 238
      *
244 239
      * @return void
245 240
      */
246
-    public static function log($message, $severity = 0)
247
-    {
241
+    public static function log($message, $severity = 0) {
248 242
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class());
249 243
 
250 244
         switch ($severity) {
@@ -274,8 +268,7 @@  discard block
 block discarded – undo
274 268
      *
275 269
      * @return mixed Hashed string or false on error
276 270
      */
277
-    public static function digest($string)
278
-    {
271
+    public static function digest($string) {
279 272
         if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
280 273
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
281 274
             return false;
@@ -294,8 +287,7 @@  discard block
 block discarded – undo
294 287
      *
295 288
      * @return mixed Encrypted string or false on error
296 289
      */
297
-    public static function encrypt($string)
298
-    {
290
+    public static function encrypt($string) {
299 291
         if (
300 292
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
301 293
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -328,8 +320,7 @@  discard block
 block discarded – undo
328 320
      *
329 321
      * @return string The unqualified class name
330 322
      */
331
-    public static function getUnqualifiedClassName($qualifiedClassname)
332
-    {
323
+    public static function getUnqualifiedClassName($qualifiedClassname) {
333 324
         $nameParts = explode('\\', $qualifiedClassname);
334 325
         return end($nameParts);
335 326
     }
@@ -343,8 +334,7 @@  discard block
 block discarded – undo
343 334
      *
344 335
      * @return string The cleaned up string
345 336
      */
346
-    public static function getCleanString($string)
347
-    {
337
+    public static function getCleanString($string) {
348 338
         // Convert to lowercase.
349 339
         $string = strtolower($string);
350 340
         // Remove non-alphanumeric characters.
@@ -365,8 +355,7 @@  discard block
 block discarded – undo
365 355
      *
366 356
      * @return array Array of hook objects for the class
367 357
      */
368
-    public static function getHookObjects($scriptRelPath)
369
-    {
358
+    public static function getHookObjects($scriptRelPath) {
370 359
         $hookObjects = [];
371 360
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
372 361
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
@@ -387,8 +376,7 @@  discard block
 block discarded – undo
387 376
      *
388 377
      * @return string "index_name" for the given UID
389 378
      */
390
-    public static function getIndexNameFromUid($uid, $table, $pid = -1)
391
-    {
379
+    public static function getIndexNameFromUid($uid, $table, $pid = -1) {
392 380
         // Sanitize input.
393 381
         $uid = max(intval($uid), 0);
394 382
         if (
@@ -438,8 +426,7 @@  discard block
 block discarded – undo
438 426
      *
439 427
      * @return string Localized full name of language or unchanged input
440 428
      */
441
-    public static function getLanguageName($code)
442
-    {
429
+    public static function getLanguageName($code) {
443 430
         // Analyze code and set appropriate ISO table.
444 431
         $isoCode = strtolower(trim($code));
445 432
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
@@ -481,8 +468,7 @@  discard block
 block discarded – undo
481 468
      *
482 469
      * @return array
483 470
      */
484
-    public static function getDocumentStructures($pid = -1)
485
-    {
471
+    public static function getDocumentStructures($pid = -1) {
486 472
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
487 473
         $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_structures');
488 474
 
@@ -522,8 +508,7 @@  discard block
 block discarded – undo
522 508
      *
523 509
      * @return string Uniform Resource Name as string
524 510
      */
525
-    public static function getURN($base, $id)
526
-    {
511
+    public static function getURN($base, $id) {
527 512
         $concordance = [
528 513
             '0' => 1,
529 514
             '1' => 2,
@@ -590,8 +575,7 @@  discard block
 block discarded – undo
590 575
      *
591 576
      * @return bool Is $id a valid PPN?
592 577
      */
593
-    public static function isPPN($id)
594
-    {
578
+    public static function isPPN($id) {
595 579
         return self::checkIdentifier($id, 'PPN');
596 580
     }
597 581
 
@@ -602,8 +586,7 @@  discard block
 block discarded – undo
602 586
      *
603 587
      * @return bool
604 588
      */
605
-    public static function isValidHttpUrl($url)
606
-    {
589
+    public static function isValidHttpUrl($url) {
607 590
         if (!GeneralUtility::isValidUrl($url)) {
608 591
             return false;
609 592
         }
@@ -629,8 +612,7 @@  discard block
 block discarded – undo
629 612
      *
630 613
      * @return array Merged array
631 614
      */
632
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
633
-    {
615
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) {
634 616
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
635 617
         return $original;
636 618
     }
@@ -644,8 +626,7 @@  discard block
 block discarded – undo
644 626
      *
645 627
      * @return string All flash messages in the queue rendered as HTML.
646 628
      */
647
-    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages')
648
-    {
629
+    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') {
649 630
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
650 631
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
651 632
         $flashMessages = $flashMessageQueue->getAllMessagesAndFlush();
@@ -665,8 +646,7 @@  discard block
 block discarded – undo
665 646
      *
666 647
      * @return string Localized label for $index_name
667 648
      */
668
-    public static function translate($index_name, $table, $pid)
669
-    {
649
+    public static function translate($index_name, $table, $pid) {
670 650
         // Load labels into static variable for future use.
671 651
         static $labels = [];
672 652
         // Sanitize input.
@@ -794,8 +774,7 @@  discard block
 block discarded – undo
794 774
      *
795 775
      * @return string Additional WHERE expression
796 776
      */
797
-    public static function whereExpression($table, $showHidden = false)
798
-    {
777
+    public static function whereExpression($table, $showHidden = false) {
799 778
         if (\TYPO3_MODE === 'FE') {
800 779
             // Should we ignore the record's hidden flag?
801 780
             $ignoreHide = 0;
@@ -827,8 +806,7 @@  discard block
 block discarded – undo
827 806
      *
828 807
      * @access private
829 808
      */
830
-    private function __construct()
831
-    {
809
+    private function __construct() {
832 810
         // This is a static class, thus no instances should be created.
833 811
     }
834 812
 
@@ -854,8 +832,7 @@  discard block
 block discarded – undo
854 832
      *
855 833
      * @access public
856 834
      */
857
-    public static function polyfillExtbaseClassesForTYPO3v9()
858
-    {
835
+    public static function polyfillExtbaseClassesForTYPO3v9() {
859 836
         $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php';
860 837
 
861 838
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
@@ -892,8 +869,7 @@  discard block
 block discarded – undo
892 869
      *
893 870
      * @return string|bool
894 871
      */
895
-    public static function getUrl(string $url)
896
-    {
872
+    public static function getUrl(string $url) {
897 873
         if (!Helper::isValidHttpUrl($url)) {
898 874
             return false;
899 875
         }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
82 82
      */
83
-    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
83
+    public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages')
84 84
     {
85 85
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
86 86
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
                     $checksum = 'X';
123 123
                 }
124 124
                 if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) {
125
-                    return false;
125
+                    return FALSE;
126 126
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
127
-                    return false;
127
+                    return FALSE;
128 128
                 }
129 129
                 break;
130 130
             case 'ZDB':
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
                     $checksum = 'X';
133 133
                 }
134 134
                 if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
135
-                    return false;
135
+                    return FALSE;
136 136
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
137
-                    return false;
137
+                    return FALSE;
138 138
                 }
139 139
                 break;
140 140
             case 'SWD':
141 141
                 $checksum = 11 - $checksum;
142 142
                 if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) {
143
-                    return false;
143
+                    return FALSE;
144 144
                 } elseif ($checksum == 10) {
145 145
                     return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
146 146
                 } elseif (substr($id, -1, 1) != $checksum) {
147
-                    return false;
147
+                    return FALSE;
148 148
                 }
149 149
                 break;
150 150
             case 'GKD':
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
                     $checksum = 'X';
154 154
                 }
155 155
                 if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
156
-                    return false;
156
+                    return FALSE;
157 157
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
158
-                    return false;
158
+                    return FALSE;
159 159
                 }
160 160
                 break;
161 161
         }
162
-        return true;
162
+        return TRUE;
163 163
     }
164 164
 
165 165
     /**
@@ -174,28 +174,28 @@  discard block
 block discarded – undo
174 174
     public static function decrypt($encrypted)
175 175
     {
176 176
         if (
177
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
178
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
177
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
178
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
179 179
         ) {
180 180
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
181
-            return false;
181
+            return FALSE;
182 182
         }
183 183
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
184 184
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
185
-            return false;
185
+            return FALSE;
186 186
         }
187 187
         if (
188 188
             empty($encrypted)
189 189
             || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm)
190 190
         ) {
191 191
             self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR);
192
-            return false;
192
+            return FALSE;
193 193
         }
194 194
         // Split initialisation vector and encrypted data.
195 195
         $binary = base64_decode($encrypted);
196 196
         $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm));
197 197
         $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm));
198
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
198
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
199 199
         // Decrypt data.
200 200
         $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
201 201
         return $decrypted;
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
         // Don't make simplexml_load_string throw (when $content is an array
217 217
         // or object)
218 218
         if (!is_string($content)) {
219
-            return false;
219
+            return FALSE;
220 220
         }
221 221
 
222 222
         // Turn off libxml's error logging.
223
-        $libxmlErrors = libxml_use_internal_errors(true);
223
+        $libxmlErrors = libxml_use_internal_errors(TRUE);
224 224
         // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept
225
-        $previousValueOfEntityLoader = libxml_disable_entity_loader(true);
225
+        $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
226 226
         // Try to load XML from file.
227 227
         $xml = simplexml_load_string($content);
228 228
         // reset entity loader setting
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
      */
277 277
     public static function digest($string)
278 278
     {
279
-        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
279
+        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) {
280 280
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
281
-            return false;
281
+            return FALSE;
282 282
         }
283 283
         // Hash string.
284 284
         $hashed = openssl_digest($string, self::$hashAlgorithm);
@@ -297,23 +297,23 @@  discard block
 block discarded – undo
297 297
     public static function encrypt($string)
298 298
     {
299 299
         if (
300
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
301
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
300
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
301
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
302 302
         ) {
303 303
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
304
-            return false;
304
+            return FALSE;
305 305
         }
306 306
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
307 307
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
308
-            return false;
308
+            return FALSE;
309 309
         }
310 310
         // Generate random initialisation vector.
311 311
         $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm));
312
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
312
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
313 313
         // Encrypt data.
314 314
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
315 315
         // Merge initialisation vector and encrypted data.
316
-        if ($encrypted !== false) {
316
+        if ($encrypted !== FALSE) {
317 317
             $encrypted = base64_encode($iv . $encrypted);
318 318
         }
319 319
         return $encrypted;
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                 $lang = $languageService->getLLL($isoCode, $iso639);
459 459
             }
460 460
         } elseif (\TYPO3_MODE === 'BE') {
461
-            $iso639 = $languageService->includeLLFile($file, false, true);
461
+            $iso639 = $languageService->includeLLFile($file, FALSE, TRUE);
462 462
             if (!empty($iso639['default'][$isoCode])) {
463 463
                 $lang = $languageService->getLLL($isoCode, $iso639);
464 464
             }
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
     public static function isValidHttpUrl($url)
606 606
     {
607 607
         if (!GeneralUtility::isValidUrl($url)) {
608
-            return false;
608
+            return FALSE;
609 609
         }
610 610
 
611 611
         $parsed = parse_url($url);
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
      *
630 630
      * @return array Merged array
631 631
      */
632
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
632
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE)
633 633
     {
634 634
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
635 635
         return $original;
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
             ->where(
702 702
                 $queryBuilder->expr()->eq($table . '.pid', $pid),
703 703
                 $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
704
-                self::whereExpression($table, true)
704
+                self::whereExpression($table, TRUE)
705 705
             )
706 706
             ->setMaxResults(1)
707 707
             ->execute();
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
                     $queryBuilder->expr()->eq($table . '.pid', $pid),
720 720
                     $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
721 721
                     $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())),
722
-                    self::whereExpression($table, true)
722
+                    self::whereExpression($table, TRUE)
723 723
                 )
724 724
                 ->setMaxResults(1)
725 725
                 ->execute();
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
                     ->where(
755 755
                         $queryBuilder->expr()->eq($table . '.pid', $pid),
756 756
                         $additionalWhere,
757
-                        self::whereExpression($table, true)
757
+                        self::whereExpression($table, TRUE)
758 758
                     )
759 759
                     ->setMaxResults(10000)
760 760
                     ->execute();
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
      *
795 795
      * @return string Additional WHERE expression
796 796
      */
797
-    public static function whereExpression($table, $showHidden = false)
797
+    public static function whereExpression($table, $showHidden = FALSE)
798 798
     {
799 799
         if (\TYPO3_MODE === 'FE') {
800 800
             // Should we ignore the record's hidden flag?
@@ -863,13 +863,13 @@  discard block
 block discarded – undo
863 863
         $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
864 864
 
865 865
         $extbaseClassmap = &$frameworkConfiguration['persistence']['classes'];
866
-        if ($extbaseClassmap === null) {
866
+        if ($extbaseClassmap === NULL) {
867 867
             $extbaseClassmap = [];
868 868
         }
869 869
 
870 870
         foreach ($classes as $className => $classConfig) {
871 871
             $extbaseClass = &$extbaseClassmap[$className];
872
-            if ($extbaseClass === null) {
872
+            if ($extbaseClass === NULL) {
873 873
                 $extbaseClass = [];
874 874
             }
875 875
             if (!isset($extbaseClass['mapping'])) {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
     public static function getUrl(string $url)
896 896
     {
897 897
         if (!Helper::isValidHttpUrl($url)) {
898
-            return false;
898
+            return FALSE;
899 899
         }
900 900
 
901 901
         // Get extension configuration.
Please login to merge, or discard this patch.
Classes/Command/BaseCommand.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@
 block discarded – undo
274 274
 
275 275
         if ($doc !== null) {
276 276
             // Get the closest ancestor of the current document which has a MPTR child.
277
-            $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $doc->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
277
+            $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$doc->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
278 278
             if (!empty($parentMptr)) {
279 279
                 $parentLocation = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href;
280 280
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@  discard block
 block discarded – undo
38 38
  * @subpackage dlf
39 39
  * @access public
40 40
  */
41
-class BaseCommand extends Command
42
-{
41
+class BaseCommand extends Command {
43 42
     /**
44 43
      * @var CollectionRepository
45 44
      */
@@ -79,8 +78,7 @@  discard block
 block discarded – undo
79 78
      *
80 79
      * @return bool
81 80
      */
82
-    protected function initializeRepositories($storagePid)
83
-    {
81
+    protected function initializeRepositories($storagePid) {
84 82
         if (MathUtility::canBeInterpretedAsInteger($storagePid)) {
85 83
             $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
86 84
             $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
@@ -159,8 +157,7 @@  discard block
 block discarded – undo
159 157
      *
160 158
      * @return bool true on success
161 159
      */
162
-    protected function saveToDatabase(Document $document)
163
-    {
160
+    protected function saveToDatabase(Document $document) {
164 161
         $success = false;
165 162
 
166 163
         $doc = $document->getDoc();
@@ -268,8 +265,7 @@  discard block
 block discarded – undo
268 265
      *
269 266
      * @return int The parent document's id.
270 267
      */
271
-    protected function getParentDocumentUidForSaving(Document $document)
272
-    {
268
+    protected function getParentDocumentUidForSaving(Document $document) {
273 269
         $doc = $document->getDoc();
274 270
 
275 271
         if ($doc !== null) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
             $this->libraryRepository = $objectManager->get(LibraryRepository::class);
97 97
             $this->structureRepository = $objectManager->get(StructureRepository::class);
98 98
         } else {
99
-            return false;
99
+            return FALSE;
100 100
         }
101 101
         $this->storagePid = MathUtility::forceIntegerInRange((int) $storagePid, 0);
102 102
 
103
-        return true;
103
+        return TRUE;
104 104
     }
105 105
 
106 106
     /**
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
      */
162 162
     protected function saveToDatabase(Document $document)
163 163
     {
164
-        $success = false;
164
+        $success = FALSE;
165 165
 
166 166
         $doc = $document->getDoc();
167
-        if ($doc === null) {
167
+        if ($doc === NULL) {
168 168
             return $success;
169 169
         }
170 170
         $doc->cPid = $this->storagePid;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             $document->setPartof($this->getParentDocumentUidForSaving($document));
245 245
         }
246 246
 
247
-        if ($document->getUid() === null) {
247
+        if ($document->getUid() === NULL) {
248 248
             // new document
249 249
             $this->documentRepository->add($document);
250 250
         } else {
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class);
256 256
         $persistenceManager->persistAll();
257 257
 
258
-        $success = true;
258
+        $success = TRUE;
259 259
 
260 260
         return $success;
261 261
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     {
273 273
         $doc = $document->getDoc();
274 274
 
275
-        if ($doc !== null) {
275
+        if ($doc !== NULL) {
276 276
             // Get the closest ancestor of the current document which has a MPTR child.
277 277
             $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $doc->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
278 278
             if (!empty($parentMptr)) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                 if ($parentDoc->recordId) {
285 285
                     $parentDocument = $this->documentRepository->findOneByRecordId($parentDoc->recordId);
286 286
 
287
-                    if ($parentDocument === null) {
287
+                    if ($parentDocument === NULL) {
288 288
                         // create new Document object
289 289
                         $parentDocument = GeneralUtility::makeInstance(Document::class);
290 290
                     }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
                     $success = $this->saveToDatabase($parentDocument);
298 298
 
299
-                    if ($success === true) {
299
+                    if ($success === TRUE) {
300 300
                         // add to index
301 301
                         Indexer::add($parentDocument);
302 302
                         return $parentDocument->getUid();
Please login to merge, or discard this patch.
Classes/Command/IndexCommand.php 3 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $this->initializeRepositories($input->getOption('pid'));
97 97
 
98 98
         if ($this->storagePid == 0) {
99
-            $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.');
99
+            $io->error('ERROR: No valid PID ('.$this->storagePid.') given.');
100 100
             exit(1);
101 101
         }
102 102
 
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
             if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) {
112 112
                 $output_solrCores = [];
113 113
                 foreach ($allSolrCores as $index_name => $uid) {
114
-                    $output_solrCores[] = $uid . ' : ' . $index_name;
114
+                    $output_solrCores[] = $uid.' : '.$index_name;
115 115
                 }
116 116
                 if (empty($output_solrCores)) {
117
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n");
117
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n");
118 118
                     exit(1);
119 119
                 } else {
120
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n");
120
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n");
121 121
                     exit(1);
122 122
                 }
123 123
             }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             $document = $this->documentRepository->findByUid($input->getOption('doc'));
158 158
 
159 159
             if ($document === null) {
160
-                $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .');
160
+                $io->error('ERROR: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.' .');
161 161
                 exit(1);
162 162
             } else {
163 163
                 $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
@@ -182,17 +182,17 @@  discard block
 block discarded – undo
182 182
         }
183 183
 
184 184
         if ($doc === null) {
185
-            $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.');
185
+            $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.');
186 186
             exit(1);
187 187
         }
188 188
 
189 189
         $document->setSolrcore($solrCoreUid);
190 190
 
191 191
         if ($dryRun) {
192
-            $io->section('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
192
+            $io->section('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
193 193
         } else {
194 194
             if ($io->isVerbose()) {
195
-                $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
195
+                $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
196 196
             }
197 197
             $document->setDoc($doc);
198 198
             // save to database
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,16 +33,14 @@  discard block
 block discarded – undo
33 33
  * @subpackage dlf
34 34
  * @access public
35 35
  */
36
-class IndexCommand extends BaseCommand
37
-{
36
+class IndexCommand extends BaseCommand {
38 37
 
39 38
     /**
40 39
      * Configure the command by defining the name, options and arguments
41 40
      *
42 41
      * @return void
43 42
      */
44
-    public function configure()
45
-    {
43
+    public function configure() {
46 44
         $this
47 45
             ->setDescription('Index single document into database and Solr.')
48 46
             ->setHelp('')
@@ -86,8 +84,7 @@  discard block
 block discarded – undo
86 84
      *
87 85
      * @return int
88 86
      */
89
-    protected function execute(InputInterface $input, OutputInterface $output)
90
-    {
87
+    protected function execute(InputInterface $input, OutputInterface $output) {
91 88
         $dryRun = $input->getOption('dry-run') != false ? true : false;
92 89
 
93 90
         $io = new SymfonyStyle($input, $output);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             ->setHelp('')
49 49
             ->addOption(
50 50
                 'dry-run',
51
-                null,
51
+                NULL,
52 52
                 InputOption::VALUE_NONE,
53 53
                 'If this option is set, the files will not actually be processed but the location URI is shown.'
54 54
             )
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     protected function execute(InputInterface $input, OutputInterface $output)
90 90
     {
91
-        $dryRun = $input->getOption('dry-run') != false ? true : false;
91
+        $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE;
92 92
 
93 93
         $io = new SymfonyStyle($input, $output);
94 94
         $io->title($this->getDescription());
@@ -145,32 +145,32 @@  discard block
 block discarded – undo
145 145
                 $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner'));
146 146
             }
147 147
         } else {
148
-            $this->owner = null;
148
+            $this->owner = NULL;
149 149
         }
150 150
 
151
-        $document = null;
152
-        $doc = null;
151
+        $document = NULL;
152
+        $doc = NULL;
153 153
 
154 154
         // Try to find existing document in database
155 155
         if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) {
156 156
 
157 157
             $document = $this->documentRepository->findByUid($input->getOption('doc'));
158 158
 
159
-            if ($document === null) {
159
+            if ($document === NULL) {
160 160
                 $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .');
161 161
                 exit(1);
162 162
             } else {
163
-                $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
163
+                $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE);
164 164
             }
165 165
 
166 166
         } else if (GeneralUtility::isValidUrl($input->getOption('doc'))) {
167
-            $doc = Doc::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], true);
167
+            $doc = Doc::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], TRUE);
168 168
 
169 169
             if ($doc->recordId) {
170 170
                 $document = $this->documentRepository->findOneByRecordId($doc->recordId);
171 171
             }
172 172
 
173
-            if ($document === null) {
173
+            if ($document === NULL) {
174 174
                 // create new Document object
175 175
                 $document = GeneralUtility::makeInstance(Document::class);
176 176
             }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             }
182 182
         }
183 183
 
184
-        if ($doc === null) {
184
+        if ($doc === NULL) {
185 185
             $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.');
186 186
             exit(1);
187 187
         }
Please login to merge, or discard this patch.
Classes/Command/ReindexCommand.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $this->initializeRepositories($input->getOption('pid'));
101 101
 
102 102
         if ($this->storagePid == 0) {
103
-            $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.');
103
+            $io->error('ERROR: No valid PID ('.$this->storagePid.') given.');
104 104
             exit(1);
105 105
         }
106 106
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
             if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) {
116 116
                 $output_solrCores = [];
117 117
                 foreach ($allSolrCores as $index_name => $uid) {
118
-                    $output_solrCores[] = $uid . ' : ' . $index_name;
118
+                    $output_solrCores[] = $uid.' : '.$index_name;
119 119
                 }
120 120
                 if (empty($output_solrCores)) {
121
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n");
121
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n");
122 122
                     exit(1);
123 123
                 } else {
124
-                    $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n");
124
+                    $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n");
125 125
                     exit(1);
126 126
                 }
127 127
             }
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
             $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
164 164
 
165 165
             if ($doc === null) {
166
-                $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.');
166
+                $io->warning('WARNING: Document "'.$document->getLocation().'" could not be loaded. Skip to next document.');
167 167
                 continue;
168 168
             }
169 169
 
170 170
             if ($dryRun) {
171
-                $io->writeln('DRY RUN: Would index ' . ($id + 1) . '/' . count($documents) . '  with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
171
+                $io->writeln('DRY RUN: Would index '.($id + 1).'/'.count($documents).'  with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
172 172
             } else {
173 173
                 if ($io->isVerbose()) {
174
-                    $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.');
174
+                    $io->writeln(date('Y-m-d H:i:s').' Indexing '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.');
175 175
                 }
176 176
                 $document->setDoc($doc);
177 177
                 // save to database
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,15 +32,13 @@  discard block
 block discarded – undo
32 32
  * @subpackage dlf
33 33
  * @access public
34 34
  */
35
-class ReindexCommand extends BaseCommand
36
-{
35
+class ReindexCommand extends BaseCommand {
37 36
     /**
38 37
      * Configure the command by defining the name, options and arguments
39 38
      *
40 39
      * @return void
41 40
      */
42
-    public function configure()
43
-    {
41
+    public function configure() {
44 42
         $this
45 43
             ->setDescription('Reindex a collection into database and Solr.')
46 44
             ->setHelp('')
@@ -90,8 +88,7 @@  discard block
 block discarded – undo
90 88
      *
91 89
      * @return int
92 90
      */
93
-    protected function execute(InputInterface $input, OutputInterface $output)
94
-    {
91
+    protected function execute(InputInterface $input, OutputInterface $output) {
95 92
         $dryRun = $input->getOption('dry-run') != false ? true : false;
96 93
 
97 94
         $io = new SymfonyStyle($input, $output);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             ->setHelp('')
47 47
             ->addOption(
48 48
                 'dry-run',
49
-                null,
49
+                NULL,
50 50
                 InputOption::VALUE_NONE,
51 51
                 'If this option is set, the files will not actually be processed but the location URI is shown.'
52 52
             )
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     protected function execute(InputInterface $input, OutputInterface $output)
94 94
     {
95
-        $dryRun = $input->getOption('dry-run') != false ? true : false;
95
+        $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE;
96 96
 
97 97
         $io = new SymfonyStyle($input, $output);
98 98
         $io->title($this->getDescription());
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                 $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner'));
138 138
             }
139 139
         } else {
140
-            $this->owner = null;
140
+            $this->owner = NULL;
141 141
         }
142 142
 
143 143
         if (!empty($input->getOption('all'))) {
@@ -148,21 +148,21 @@  discard block
 block discarded – undo
148 148
             && !is_array($input->getOption('coll'))
149 149
         ) {
150 150
             // "coll" may be a single integer or a comma-separated list of integers.
151
-            if (empty(array_filter(GeneralUtility::intExplode(',', $input->getOption('coll'), true)))) {
151
+            if (empty(array_filter(GeneralUtility::intExplode(',', $input->getOption('coll'), TRUE)))) {
152 152
                 $io->error('ERROR: Parameter --coll|-c is not a valid comma-separated list of collection UIDs.');
153 153
                 exit(1);
154 154
             }
155 155
             // Get all documents of given collections.
156
-            $documents = $this->documentRepository->findAllByCollectionsLimited(GeneralUtility::intExplode(',', $input->getOption('coll'), true), 0);
156
+            $documents = $this->documentRepository->findAllByCollectionsLimited(GeneralUtility::intExplode(',', $input->getOption('coll'), TRUE), 0);
157 157
         } else {
158 158
             $io->error('ERROR: One of parameters --all|-a or --coll|-c must be given.');
159 159
             exit(1);
160 160
         }
161 161
 
162 162
         foreach ($documents as $id => $document) {
163
-            $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true);
163
+            $doc = Doc::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE);
164 164
 
165
-            if ($doc === null) {
165
+            if ($doc === NULL) {
166 166
                 $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.');
167 167
                 continue;
168 168
             }
Please login to merge, or discard this patch.