@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | if ($this->document) { |
158 | 158 | $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
159 | 159 | } else { |
160 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
160 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
161 | 161 | } |
162 | 162 | } else if (GeneralUtility::isValidUrl($requestData['id'])) { |
163 | 163 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $this->document->setLocation($requestData['id']); |
177 | 177 | } else { |
178 | - $this->logger->error('Invalid location given "' . $requestData['id'] . '" for document loading'); |
|
178 | + $this->logger->error('Invalid location given "'.$requestData['id'].'" for document loading'); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | if ($this->document !== null && $doc !== null) { |
193 | 193 | $this->document->setDoc($doc); |
194 | 194 | } else { |
195 | - $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |
|
195 | + $this->logger->error('Failed to load document with record ID "'.$requestData['recordId'].'"'); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | } else { |
199 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
199 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | } |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @return ExpressionFunction[] An array of Function instances |
43 | 43 | */ |
44 | - public function getFunctions() |
|
45 | - { |
|
44 | + public function getFunctions() { |
|
46 | 45 | return [ |
47 | 46 | $this->getDocumentTypeFunction(), |
48 | 47 | ]; |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | * |
69 | 68 | * @return void |
70 | 69 | */ |
71 | - protected function initializeRepositories($storagePid) |
|
72 | - { |
|
70 | + protected function initializeRepositories($storagePid) { |
|
73 | 71 | Helper::polyfillExtbaseClassesForTYPO3v9(); |
74 | 72 | |
75 | 73 | // TODO: When we drop support for TYPO3v9, we needn't/shouldn't use ObjectManager anymore |
@@ -92,12 +90,10 @@ discard block |
||
92 | 90 | { |
93 | 91 | return new ExpressionFunction( |
94 | 92 | 'getDocumentType', |
95 | - function() |
|
96 | - { |
|
93 | + function() { |
|
97 | 94 | // Not implemented, we only use the evaluator |
98 | 95 | }, |
99 | - function($arguments, $cPid) |
|
100 | - { |
|
96 | + function($arguments, $cPid) { |
|
101 | 97 | /** @var RequestWrapper $requestWrapper */ |
102 | 98 | $requestWrapper = $arguments['request']; |
103 | 99 | $queryParams = $requestWrapper->getQueryParams(); |
@@ -143,8 +139,7 @@ discard block |
||
143 | 139 | * |
144 | 140 | * @return void |
145 | 141 | */ |
146 | - protected function loadDocument($requestData, int $pid) |
|
147 | - { |
|
142 | + protected function loadDocument($requestData, int $pid) { |
|
148 | 143 | // Try to get document format from database |
149 | 144 | if (!empty($requestData['id'])) { |
150 | 145 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | // Load document with current plugin parameters. |
114 | 114 | $this->loadDocument($queryParams['tx_dlf'], $cPid); |
115 | - if ($this->document === null) { |
|
115 | + if ($this->document === NULL) { |
|
116 | 116 | return $type; |
117 | 117 | } |
118 | 118 | // Set PID for metadata definitions. |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // Calendar plugin does not support IIIF (yet). Abort for all newspaper related types. |
124 | 124 | if ( |
125 | 125 | $this->document->getDoc() instanceof IiifManifest |
126 | - && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== false |
|
126 | + && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== FALSE |
|
127 | 127 | ) { |
128 | 128 | return $type; |
129 | 129 | } |
@@ -150,25 +150,25 @@ discard block |
||
150 | 150 | |
151 | 151 | $this->initializeRepositories($pid); |
152 | 152 | |
153 | - $doc = null; |
|
153 | + $doc = NULL; |
|
154 | 154 | if (MathUtility::canBeInterpretedAsInteger($requestData['id'])) { |
155 | 155 | // find document from repository by uid |
156 | 156 | $this->document = $this->documentRepository->findOneByIdAndSettings((int) $requestData['id'], ['storagePid' => $pid]); |
157 | 157 | if ($this->document) { |
158 | - $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
158 | + $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
159 | 159 | } else { |
160 | 160 | $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
161 | 161 | } |
162 | 162 | } else if (GeneralUtility::isValidUrl($requestData['id'])) { |
163 | 163 | |
164 | - $doc = Doc::getInstance($requestData['id'], ['storagePid' => $pid], true); |
|
164 | + $doc = Doc::getInstance($requestData['id'], ['storagePid' => $pid], TRUE); |
|
165 | 165 | |
166 | - if ($doc !== null) { |
|
166 | + if ($doc !== NULL) { |
|
167 | 167 | if ($doc->recordId) { |
168 | 168 | $this->document = $this->documentRepository->findOneByRecordId($doc->recordId); |
169 | 169 | } |
170 | 170 | |
171 | - if ($this->document === null) { |
|
171 | + if ($this->document === NULL) { |
|
172 | 172 | // create new dummy Document object |
173 | 173 | $this->document = GeneralUtility::makeInstance(Document::class); |
174 | 174 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - if ($this->document !== null && $doc !== null) { |
|
182 | + if ($this->document !== NULL && $doc !== NULL) { |
|
183 | 183 | $this->document->setDoc($doc); |
184 | 184 | } |
185 | 185 | |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | $this->document = $this->documentRepository->findOneByRecordId($requestData['recordId']); |
189 | 189 | |
190 | - if ($this->document !== null) { |
|
191 | - $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
192 | - if ($this->document !== null && $doc !== null) { |
|
190 | + if ($this->document !== NULL) { |
|
191 | + $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
192 | + if ($this->document !== NULL && $doc !== NULL) { |
|
193 | 193 | $this->document->setDoc($doc); |
194 | 194 | } else { |
195 | 195 | $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |
@@ -134,7 +134,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'], |
@@ -37,8 +37,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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. |
@@ -55,7 +55,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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. |
@@ -24,8 +24,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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])) { |
@@ -81,7 +81,7 @@ |
||
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 |
@@ -569,14 +569,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -104,7 +104,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -49,8 +49,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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->pid = $pid; |
1171 | 1144 | $this->setPreloadedDocument($preloadedDocument); |
1172 | 1145 | $this->init($location); |
@@ -1183,8 +1156,7 @@ discard block |
||
1183 | 1156 | * |
1184 | 1157 | * @return mixed Value of $this->$var |
1185 | 1158 | */ |
1186 | - public function __get($var) |
|
1187 | - { |
|
1159 | + public function __get($var) { |
|
1188 | 1160 | $method = '_get' . ucfirst($var); |
1189 | 1161 | if ( |
1190 | 1162 | !property_exists($this, $var) |
@@ -1206,8 +1178,7 @@ discard block |
||
1206 | 1178 | * |
1207 | 1179 | * @return bool true if variable is set and not empty, false otherwise |
1208 | 1180 | */ |
1209 | - public function __isset($var) |
|
1210 | - { |
|
1181 | + public function __isset($var) { |
|
1211 | 1182 | return !empty($this->__get($var)); |
1212 | 1183 | } |
1213 | 1184 | |
@@ -1221,8 +1192,7 @@ discard block |
||
1221 | 1192 | * |
1222 | 1193 | * @return void |
1223 | 1194 | */ |
1224 | - public function __set($var, $value) |
|
1225 | - { |
|
1195 | + public function __set($var, $value) { |
|
1226 | 1196 | $method = '_set' . ucfirst($var); |
1227 | 1197 | if ( |
1228 | 1198 | !property_exists($this, $var) |
@@ -1240,8 +1210,7 @@ discard block |
||
1240 | 1210 | * @param string $location |
1241 | 1211 | * @return Doc|false |
1242 | 1212 | */ |
1243 | - private static function getDocCache(string $location) |
|
1244 | - { |
|
1213 | + private static function getDocCache(string $location) { |
|
1245 | 1214 | $cacheIdentifier = md5($location); |
1246 | 1215 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc'); |
1247 | 1216 | $cacheHit = $cache->get($cacheIdentifier); |
@@ -1256,8 +1225,7 @@ discard block |
||
1256 | 1225 | * @param Doc $doc |
1257 | 1226 | * @return void |
1258 | 1227 | */ |
1259 | - private static function setDocCache(string $location, Doc $doc) |
|
1260 | - { |
|
1228 | + private static function setDocCache(string $location, Doc $doc) { |
|
1261 | 1229 | $cacheIdentifier = md5($location); |
1262 | 1230 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc'); |
1263 | 1231 |
@@ -38,8 +38,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -298,7 +298,7 @@ |
||
298 | 298 | if ($doc !== null) { |
299 | 299 | // Same as MetsDocument::parentHref (TODO: Use it) |
300 | 300 | // Get the closest ancestor of the current document which has a MPTR child. |
301 | - $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $doc->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
301 | + $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$doc->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
302 | 302 | if (!empty($parentMptr)) { |
303 | 303 | $parentLocation = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
304 | 304 |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | // Get extension configuration. |
108 | 108 | $this->extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf'); |
109 | 109 | } else { |
110 | - return false; |
|
110 | + return FALSE; |
|
111 | 111 | } |
112 | 112 | $this->storagePid = MathUtility::forceIntegerInRange((int) $storagePid, 0); |
113 | 113 | |
114 | - return true; |
|
114 | + return TRUE; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | */ |
173 | 173 | protected function saveToDatabase(Document $document) |
174 | 174 | { |
175 | - $success = false; |
|
175 | + $success = FALSE; |
|
176 | 176 | |
177 | 177 | $doc = $document->getDoc(); |
178 | - if ($doc === null) { |
|
178 | + if ($doc === NULL) { |
|
179 | 179 | return $success; |
180 | 180 | } |
181 | 181 | $doc->cPid = $this->storagePid; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $document->setPartof($this->getParentDocumentUidForSaving($document)); |
268 | 268 | } |
269 | 269 | |
270 | - if ($document->getUid() === null) { |
|
270 | + if ($document->getUid() === NULL) { |
|
271 | 271 | // new document |
272 | 272 | $this->documentRepository->add($document); |
273 | 273 | } else { |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
279 | 279 | $persistenceManager->persistAll(); |
280 | 280 | |
281 | - $success = true; |
|
281 | + $success = TRUE; |
|
282 | 282 | |
283 | 283 | return $success; |
284 | 284 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | { |
296 | 296 | $doc = $document->getDoc(); |
297 | 297 | |
298 | - if ($doc !== null) { |
|
298 | + if ($doc !== NULL) { |
|
299 | 299 | // Same as MetsDocument::parentHref (TODO: Use it) |
300 | 300 | // Get the closest ancestor of the current document which has a MPTR child. |
301 | 301 | $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $doc->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | if ($parentDoc->recordId) { |
309 | 309 | $parentDocument = $this->documentRepository->findOneByRecordId($parentDoc->recordId); |
310 | 310 | |
311 | - if ($parentDocument === null) { |
|
311 | + if ($parentDocument === NULL) { |
|
312 | 312 | // create new Document object |
313 | 313 | $parentDocument = GeneralUtility::makeInstance(Document::class); |
314 | 314 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | $success = $this->saveToDatabase($parentDocument); |
322 | 322 | |
323 | - if ($success === true) { |
|
323 | + if ($success === TRUE) { |
|
324 | 324 | // add to index |
325 | 325 | Indexer::add($parentDocument); |
326 | 326 | return $parentDocument->getUid(); |
@@ -96,7 +96,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -33,16 +33,14 @@ discard block |
||
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 |
||
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); |
@@ -48,7 +48,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -100,7 +100,7 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -32,15 +32,13 @@ discard block |
||
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 |
||
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); |
@@ -46,7 +46,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $this->initializeRepositories($input->getOption('pid')); |
111 | 111 | |
112 | 112 | if ($this->storagePid == 0) { |
113 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
113 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
114 | 114 | exit(1); |
115 | 115 | } |
116 | 116 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
129 | 129 | $output_solrCores = []; |
130 | 130 | foreach ($allSolrCores as $index_name => $uid) { |
131 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
131 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
132 | 132 | } |
133 | 133 | if (empty($output_solrCores)) { |
134 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
134 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
135 | 135 | exit(1); |
136 | 136 | } else { |
137 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
137 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
138 | 138 | exit(1); |
139 | 139 | } |
140 | 140 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | exit(1); |
155 | 155 | } |
156 | 156 | if (!GeneralUtility::isValidUrl($baseUrl)) { |
157 | - $io->error('ERROR: No valid OAI Base URL set for library with given UID ("' . $input->getOption('lib') . '").'); |
|
157 | + $io->error('ERROR: No valid OAI Base URL set for library with given UID ("'.$input->getOption('lib').'").'); |
|
158 | 158 | exit(1); |
159 | 159 | } else { |
160 | 160 | try { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | } |
197 | 197 | if (empty($set)) { |
198 | - $io->error('ERROR: OAI interface does not provide a set with given setSpec ("' . $input->getOption('set') . '").'); |
|
198 | + $io->error('ERROR: OAI interface does not provide a set with given setSpec ("'.$input->getOption('set').'").'); |
|
199 | 199 | exit(1); |
200 | 200 | } |
201 | 201 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // Process all identifiers. |
211 | - $baseLocation = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
211 | + $baseLocation = $baseUrl.(parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
212 | 212 | foreach ($identifiers as $identifier) { |
213 | 213 | // Build OAI GetRecord URL... |
214 | 214 | $params = [ |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | 'metadataPrefix' => 'mets', |
217 | 217 | 'identifier' => (string) $identifier->identifier |
218 | 218 | ]; |
219 | - $docLocation = $baseLocation . http_build_query($params); |
|
219 | + $docLocation = $baseLocation.http_build_query($params); |
|
220 | 220 | // ...index the document... |
221 | 221 | $document = null; |
222 | 222 | $doc = Doc::getInstance($docLocation, ['storagePid' => $this->storagePid], true); |
223 | 223 | |
224 | 224 | if ($doc === null) { |
225 | - $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.'); |
|
225 | + $io->warning('WARNING: Document "'.$docLocation.'" could not be loaded. Skip to next document.'); |
|
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | $document->setSolrcore($solrCoreUid); |
240 | 240 | |
241 | 241 | if ($dryRun) { |
242 | - $io->writeln('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
242 | + $io->writeln('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
243 | 243 | } else { |
244 | 244 | if ($io->isVerbose()) { |
245 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
245 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
246 | 246 | } |
247 | 247 | $document->setDoc($doc); |
248 | 248 | // save to database |
@@ -267,6 +267,6 @@ discard block |
||
267 | 267 | */ |
268 | 268 | protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) |
269 | 269 | { |
270 | - $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n " . $exception->getMessage()); |
|
270 | + $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:'."\n ".$exception->getMessage()); |
|
271 | 271 | } |
272 | 272 | } |
@@ -36,15 +36,13 @@ discard block |
||
36 | 36 | * @subpackage dlf |
37 | 37 | * @access public |
38 | 38 | */ |
39 | -class HarvestCommand extends BaseCommand |
|
40 | -{ |
|
39 | +class HarvestCommand extends BaseCommand { |
|
41 | 40 | /** |
42 | 41 | * Configure the command by defining the name, options and arguments |
43 | 42 | * |
44 | 43 | * @return void |
45 | 44 | */ |
46 | - public function configure() |
|
47 | - { |
|
45 | + public function configure() { |
|
48 | 46 | $this |
49 | 47 | ->setDescription('Harvest OAI-PMH contents into database and Solr.') |
50 | 48 | ->setHelp('') |
@@ -100,8 +98,7 @@ discard block |
||
100 | 98 | * |
101 | 99 | * @return int |
102 | 100 | */ |
103 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
104 | - { |
|
101 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
105 | 102 | $dryRun = $input->getOption('dry-run') != false ? true : false; |
106 | 103 | |
107 | 104 | $io = new SymfonyStyle($input, $output); |
@@ -265,8 +262,7 @@ discard block |
||
265 | 262 | * |
266 | 263 | * @return void |
267 | 264 | */ |
268 | - protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) |
|
269 | - { |
|
265 | + protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io) { |
|
270 | 266 | $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n " . $exception->getMessage()); |
271 | 267 | } |
272 | 268 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | ->setHelp('') |
51 | 51 | ->addOption( |
52 | 52 | 'dry-run', |
53 | - null, |
|
53 | + NULL, |
|
54 | 54 | InputOption::VALUE_NONE, |
55 | 55 | 'If this option is set, the files will not actually be processed but the location URIs are shown.' |
56 | 56 | ) |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | ) |
75 | 75 | ->addOption( |
76 | 76 | 'from', |
77 | - null, |
|
77 | + NULL, |
|
78 | 78 | InputOption::VALUE_OPTIONAL, |
79 | 79 | 'Datestamp (YYYY-MM-DD) to begin harvesting from.' |
80 | 80 | ) |
81 | 81 | ->addOption( |
82 | 82 | 'until', |
83 | - null, |
|
83 | + NULL, |
|
84 | 84 | InputOption::VALUE_OPTIONAL, |
85 | 85 | 'Datestamp (YYYY-MM-DD) to end harvesting on.' |
86 | 86 | ) |
87 | 87 | ->addOption( |
88 | 88 | 'set', |
89 | - null, |
|
89 | + NULL, |
|
90 | 90 | InputOption::VALUE_OPTIONAL, |
91 | 91 | 'Name of the set to limit harvesting to.' |
92 | 92 | ); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected function execute(InputInterface $input, OutputInterface $output) |
104 | 104 | { |
105 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
105 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
106 | 106 | |
107 | 107 | $io = new SymfonyStyle($input, $output); |
108 | 108 | $io->title($this->getDescription()); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | ) { |
171 | 171 | $from = new \DateTime($input->getOption('from')); |
172 | 172 | } else { |
173 | - $from = null; |
|
173 | + $from = NULL; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | if ( |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | ) { |
180 | 180 | $until = new \DateTime($input->getOption('until')); |
181 | 181 | } else { |
182 | - $until = null; |
|
182 | + $until = NULL; |
|
183 | 183 | } |
184 | 184 | |
185 | - $set = null; |
|
185 | + $set = NULL; |
|
186 | 186 | if ( |
187 | 187 | !is_array($input->getOption('set')) |
188 | 188 | && !empty($input->getOption('set')) |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | ]; |
219 | 219 | $docLocation = $baseLocation . http_build_query($params); |
220 | 220 | // ...index the document... |
221 | - $document = null; |
|
222 | - $doc = Doc::getInstance($docLocation, ['storagePid' => $this->storagePid], true); |
|
221 | + $document = NULL; |
|
222 | + $doc = Doc::getInstance($docLocation, ['storagePid' => $this->storagePid], TRUE); |
|
223 | 223 | |
224 | - if ($doc === null) { |
|
224 | + if ($doc === NULL) { |
|
225 | 225 | $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.'); |
226 | 226 | continue; |
227 | 227 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $document = $this->documentRepository->findOneByRecordId($doc->recordId); |
231 | 231 | } |
232 | 232 | |
233 | - if ($document === null) { |
|
233 | + if ($document === NULL) { |
|
234 | 234 | // create new Document object |
235 | 235 | $document = GeneralUtility::makeInstance(Document::class); |
236 | 236 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getDescription(): string |
56 | 56 | { |
57 | - return 'This wizard migrates existing front end plugins of the extension Kitodo.Presentation (dlf) to' . |
|
58 | - ' make use of the Extbase naming scheme. Therefore it updates the field values' . |
|
57 | + return 'This wizard migrates existing front end plugins of the extension Kitodo.Presentation (dlf) to'. |
|
58 | + ' make use of the Extbase naming scheme. Therefore it updates the field values'. |
|
59 | 59 | ' "pi_flexform" within the tt_content table'; |
60 | 60 | } |
61 | 61 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | foreach ($fields as $field) { |
171 | 171 | // change the index attribute if it doesn't start with 'settings.' yet |
172 | 172 | if (strpos($field['index'], 'settings.') === false) { |
173 | - $field['index'] = 'settings.' . $field['index']; |
|
173 | + $field['index'] = 'settings.'.$field['index']; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 |
@@ -23,8 +23,7 @@ |
||
23 | 23 | * Class MigrateSettings |
24 | 24 | * @internal |
25 | 25 | */ |
26 | -class MigrateSettings implements UpgradeWizardInterface |
|
27 | -{ |
|
26 | +class MigrateSettings implements UpgradeWizardInterface { |
|
28 | 27 | |
29 | 28 | /** |
30 | 29 | * Return the identifier for this wizard |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | |
98 | 98 | // exit if at least one update statement is not successful |
99 | 99 | if (!((bool) $updateResult)) { |
100 | - return false; |
|
100 | + return FALSE; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - return true; |
|
104 | + return TRUE; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function updateNecessary(): bool |
115 | 115 | { |
116 | - $oldSettingsFound = false; |
|
116 | + $oldSettingsFound = FALSE; |
|
117 | 117 | |
118 | 118 | $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tt_content'); |
119 | 119 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | // Update the found record sets |
132 | 132 | while ($record = $statement->fetch()) { |
133 | 133 | $oldSettingsFound = $this->checkForOldSettings($record['pi_flexform']); |
134 | - if ($oldSettingsFound === true) { |
|
134 | + if ($oldSettingsFound === TRUE) { |
|
135 | 135 | // We found at least one field to be updated --> break here |
136 | 136 | break; |
137 | 137 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | foreach ($fields as $field) { |
171 | 171 | // change the index attribute if it doesn't start with 'settings.' yet |
172 | - if (strpos($field['index'], 'settings.') === false) { |
|
172 | + if (strpos($field['index'], 'settings.') === FALSE) { |
|
173 | 173 | $field['index'] = 'settings.' . $field['index']; |
174 | 174 | } |
175 | 175 | } |