@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | * @subpackage dlf |
| 33 | 33 | * @access public |
| 34 | 34 | */ |
| 35 | -class Helper |
|
| 36 | -{ |
|
| 35 | +class Helper { |
|
| 37 | 36 | /** |
| 38 | 37 | * The extension key |
| 39 | 38 | * |
@@ -81,8 +80,7 @@ discard block |
||
| 81 | 80 | * |
| 82 | 81 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 83 | 82 | */ |
| 84 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
| 85 | - { |
|
| 83 | + public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') { |
|
| 86 | 84 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 87 | 85 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 88 | 86 | $flashMessage = GeneralUtility::makeInstance( |
@@ -107,8 +105,7 @@ discard block |
||
| 107 | 105 | * |
| 108 | 106 | * @return bool Is $id a valid GNL identifier of the given $type? |
| 109 | 107 | */ |
| 110 | - public static function checkIdentifier($id, $type) |
|
| 111 | - { |
|
| 108 | + public static function checkIdentifier($id, $type) { |
|
| 112 | 109 | $digits = substr($id, 0, 8); |
| 113 | 110 | $checksum = 0; |
| 114 | 111 | for ($i = 0, $j = strlen($digits); $i < $j; $i++) { |
@@ -172,8 +169,7 @@ discard block |
||
| 172 | 169 | * |
| 173 | 170 | * @return mixed The decrypted value or false on error |
| 174 | 171 | */ |
| 175 | - public static function decrypt($encrypted) |
|
| 176 | - { |
|
| 172 | + public static function decrypt($encrypted) { |
|
| 177 | 173 | if ( |
| 178 | 174 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 179 | 175 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -212,8 +208,7 @@ discard block |
||
| 212 | 208 | * |
| 213 | 209 | * @return \SimpleXMLElement|false |
| 214 | 210 | */ |
| 215 | - public static function getXmlFileAsString($content) |
|
| 216 | - { |
|
| 211 | + public static function getXmlFileAsString($content) { |
|
| 217 | 212 | // Don't make simplexml_load_string throw (when $content is an array |
| 218 | 213 | // or object) |
| 219 | 214 | if (!is_string($content)) { |
@@ -244,8 +239,7 @@ discard block |
||
| 244 | 239 | * |
| 245 | 240 | * @return void |
| 246 | 241 | */ |
| 247 | - public static function log($message, $severity = 0) |
|
| 248 | - { |
|
| 242 | + public static function log($message, $severity = 0) { |
|
| 249 | 243 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class()); |
| 250 | 244 | |
| 251 | 245 | switch ($severity) { |
@@ -275,8 +269,7 @@ discard block |
||
| 275 | 269 | * |
| 276 | 270 | * @return mixed Hashed string or false on error |
| 277 | 271 | */ |
| 278 | - public static function digest($string) |
|
| 279 | - { |
|
| 272 | + public static function digest($string) { |
|
| 280 | 273 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
| 281 | 274 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
| 282 | 275 | return false; |
@@ -295,8 +288,7 @@ discard block |
||
| 295 | 288 | * |
| 296 | 289 | * @return mixed Encrypted string or false on error |
| 297 | 290 | */ |
| 298 | - public static function encrypt($string) |
|
| 299 | - { |
|
| 291 | + public static function encrypt($string) { |
|
| 300 | 292 | if ( |
| 301 | 293 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 302 | 294 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -329,8 +321,7 @@ discard block |
||
| 329 | 321 | * |
| 330 | 322 | * @return string The unqualified class name |
| 331 | 323 | */ |
| 332 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
| 333 | - { |
|
| 324 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
| 334 | 325 | $nameParts = explode('\\', $qualifiedClassname); |
| 335 | 326 | return end($nameParts); |
| 336 | 327 | } |
@@ -344,8 +335,7 @@ discard block |
||
| 344 | 335 | * |
| 345 | 336 | * @return string The cleaned up string |
| 346 | 337 | */ |
| 347 | - public static function getCleanString($string) |
|
| 348 | - { |
|
| 338 | + public static function getCleanString($string) { |
|
| 349 | 339 | // Convert to lowercase. |
| 350 | 340 | $string = strtolower($string); |
| 351 | 341 | // Remove non-alphanumeric characters. |
@@ -366,8 +356,7 @@ discard block |
||
| 366 | 356 | * |
| 367 | 357 | * @return array Array of hook objects for the class |
| 368 | 358 | */ |
| 369 | - public static function getHookObjects($scriptRelPath) |
|
| 370 | - { |
|
| 359 | + public static function getHookObjects($scriptRelPath) { |
|
| 371 | 360 | $hookObjects = []; |
| 372 | 361 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
| 373 | 362 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -388,8 +377,7 @@ discard block |
||
| 388 | 377 | * |
| 389 | 378 | * @return string "index_name" for the given UID |
| 390 | 379 | */ |
| 391 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
| 392 | - { |
|
| 380 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
| 393 | 381 | // Sanitize input. |
| 394 | 382 | $uid = max(intval($uid), 0); |
| 395 | 383 | if ( |
@@ -447,8 +435,7 @@ discard block |
||
| 447 | 435 | * |
| 448 | 436 | * @return string Localized full name of language or unchanged input |
| 449 | 437 | */ |
| 450 | - public static function getLanguageName($code) |
|
| 451 | - { |
|
| 438 | + public static function getLanguageName($code) { |
|
| 452 | 439 | // Analyze code and set appropriate ISO table. |
| 453 | 440 | $isoCode = strtolower(trim($code)); |
| 454 | 441 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -475,8 +462,7 @@ discard block |
||
| 475 | 462 | * |
| 476 | 463 | * @return array |
| 477 | 464 | */ |
| 478 | - public static function getDocumentStructures($pid = -1) |
|
| 479 | - { |
|
| 465 | + public static function getDocumentStructures($pid = -1) { |
|
| 480 | 466 | // TODO: Against redundancy with getIndexNameFromUid |
| 481 | 467 | |
| 482 | 468 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
@@ -518,8 +504,7 @@ discard block |
||
| 518 | 504 | * |
| 519 | 505 | * @return string Uniform Resource Name as string |
| 520 | 506 | */ |
| 521 | - public static function getURN($base, $id) |
|
| 522 | - { |
|
| 507 | + public static function getURN($base, $id) { |
|
| 523 | 508 | $concordance = [ |
| 524 | 509 | '0' => 1, |
| 525 | 510 | '1' => 2, |
@@ -586,8 +571,7 @@ discard block |
||
| 586 | 571 | * |
| 587 | 572 | * @return bool Is $id a valid PPN? |
| 588 | 573 | */ |
| 589 | - public static function isPPN($id) |
|
| 590 | - { |
|
| 574 | + public static function isPPN($id) { |
|
| 591 | 575 | return self::checkIdentifier($id, 'PPN'); |
| 592 | 576 | } |
| 593 | 577 | |
@@ -598,8 +582,7 @@ discard block |
||
| 598 | 582 | * |
| 599 | 583 | * @return bool |
| 600 | 584 | */ |
| 601 | - public static function isValidHttpUrl($url) |
|
| 602 | - { |
|
| 585 | + public static function isValidHttpUrl($url) { |
|
| 603 | 586 | if (!GeneralUtility::isValidUrl($url)) { |
| 604 | 587 | return false; |
| 605 | 588 | } |
@@ -625,8 +608,7 @@ discard block |
||
| 625 | 608 | * |
| 626 | 609 | * @return array Merged array |
| 627 | 610 | */ |
| 628 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 629 | - { |
|
| 611 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
| 630 | 612 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 631 | 613 | return $original; |
| 632 | 614 | } |
@@ -640,8 +622,7 @@ discard block |
||
| 640 | 622 | * |
| 641 | 623 | * @return string All flash messages in the queue rendered as HTML. |
| 642 | 624 | */ |
| 643 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
| 644 | - { |
|
| 625 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
| 645 | 626 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 646 | 627 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 647 | 628 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -661,8 +642,7 @@ discard block |
||
| 661 | 642 | * |
| 662 | 643 | * @return string Localized label for $index_name |
| 663 | 644 | */ |
| 664 | - public static function translate($index_name, $table, $pid) |
|
| 665 | - { |
|
| 645 | + public static function translate($index_name, $table, $pid) { |
|
| 666 | 646 | // Load labels into static variable for future use. |
| 667 | 647 | static $labels = []; |
| 668 | 648 | // Sanitize input. |
@@ -790,8 +770,7 @@ discard block |
||
| 790 | 770 | * |
| 791 | 771 | * @return string Additional WHERE expression |
| 792 | 772 | */ |
| 793 | - public static function whereExpression($table, $showHidden = false) |
|
| 794 | - { |
|
| 773 | + public static function whereExpression($table, $showHidden = false) { |
|
| 795 | 774 | if (\TYPO3_MODE === 'FE') { |
| 796 | 775 | // Should we ignore the record's hidden flag? |
| 797 | 776 | $ignoreHide = 0; |
@@ -823,8 +802,7 @@ discard block |
||
| 823 | 802 | * |
| 824 | 803 | * @access private |
| 825 | 804 | */ |
| 826 | - private function __construct() |
|
| 827 | - { |
|
| 805 | + private function __construct() { |
|
| 828 | 806 | // This is a static class, thus no instances should be created. |
| 829 | 807 | } |
| 830 | 808 | |
@@ -850,8 +828,7 @@ discard block |
||
| 850 | 828 | * |
| 851 | 829 | * @access public |
| 852 | 830 | */ |
| 853 | - public static function polyfillExtbaseClassesForTYPO3v9() |
|
| 854 | - { |
|
| 831 | + public static function polyfillExtbaseClassesForTYPO3v9() { |
|
| 855 | 832 | $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php'; |
| 856 | 833 | |
| 857 | 834 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
@@ -888,8 +865,7 @@ discard block |
||
| 888 | 865 | * |
| 889 | 866 | * @return string|bool |
| 890 | 867 | */ |
| 891 | - public static function getUrl(string $url) |
|
| 892 | - { |
|
| 868 | + public static function getUrl(string $url) { |
|
| 893 | 869 | if (!Helper::isValidHttpUrl($url)) { |
| 894 | 870 | return false; |
| 895 | 871 | } |
@@ -10,10 +10,8 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * Targeted towards being used in ``PaginateController`` (``<f:widget.paginate>``). |
| 12 | 12 | */ |
| 13 | -class SolrSearchQuery implements QueryInterface |
|
| 14 | -{ |
|
| 15 | - public function __construct($solrSearch) |
|
| 16 | - { |
|
| 13 | +class SolrSearchQuery implements QueryInterface { |
|
| 14 | + public function __construct($solrSearch) { |
|
| 17 | 15 | $this->solrSearch = $solrSearch; |
| 18 | 16 | |
| 19 | 17 | $this->offset = 0; |
@@ -22,8 +20,7 @@ discard block |
||
| 22 | 20 | |
| 23 | 21 | public function getSource() {} |
| 24 | 22 | |
| 25 | - public function execute($returnRawQueryResult = false) |
|
| 26 | - { |
|
| 23 | + public function execute($returnRawQueryResult = false) { |
|
| 27 | 24 | $this->solrSearch->submit($this->offset, $this->limit); |
| 28 | 25 | |
| 29 | 26 | // solrSearch now only contains the results in range, indexed in [0, n) |
@@ -37,14 +34,12 @@ discard block |
||
| 37 | 34 | |
| 38 | 35 | public function setOrderings(array $orderings) {} |
| 39 | 36 | |
| 40 | - public function setLimit($limit) |
|
| 41 | - { |
|
| 37 | + public function setLimit($limit) { |
|
| 42 | 38 | $this->limit = $limit; |
| 43 | 39 | return $this; |
| 44 | 40 | } |
| 45 | 41 | |
| 46 | - public function setOffset($offset) |
|
| 47 | - { |
|
| 42 | + public function setOffset($offset) { |
|
| 48 | 43 | $this->offset = $offset; |
| 49 | 44 | return $this; |
| 50 | 45 | } |
@@ -65,20 +60,17 @@ discard block |
||
| 65 | 60 | public function setQuerySettings(QuerySettingsInterface $querySettings) {} |
| 66 | 61 | public function getQuerySettings() {} |
| 67 | 62 | |
| 68 | - public function count() |
|
| 69 | - { |
|
| 63 | + public function count() { |
|
| 70 | 64 | // TODO? |
| 71 | 65 | } |
| 72 | 66 | |
| 73 | 67 | public function getOrderings() {} |
| 74 | 68 | |
| 75 | - public function getLimit() |
|
| 76 | - { |
|
| 69 | + public function getLimit() { |
|
| 77 | 70 | return $this->limit; |
| 78 | 71 | } |
| 79 | 72 | |
| 80 | - public function getOffset() |
|
| 81 | - { |
|
| 73 | + public function getOffset() { |
|
| 82 | 74 | return $this->offset; |
| 83 | 75 | } |
| 84 | 76 | |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
| 50 | 50 | */ |
| 51 | - public function findOneByParameters($parameters) |
|
| 52 | - { |
|
| 51 | + public function findOneByParameters($parameters) { |
|
| 53 | 52 | $doc = null; |
| 54 | 53 | $document = null; |
| 55 | 54 | |
@@ -93,8 +92,7 @@ discard block |
||
| 93 | 92 | * |
| 94 | 93 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
| 95 | 94 | */ |
| 96 | - public function findOldestDocument() |
|
| 97 | - { |
|
| 95 | + public function findOldestDocument() { |
|
| 98 | 96 | $query = $this->createQuery(); |
| 99 | 97 | |
| 100 | 98 | $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]); |
@@ -108,8 +106,7 @@ discard block |
||
| 108 | 106 | * @param \Kitodo\Dlf\Domain\Model\Structure $structure |
| 109 | 107 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
| 110 | 108 | */ |
| 111 | - public function getChildrenOfYearAnchor($partOf, $structure) |
|
| 112 | - { |
|
| 109 | + public function getChildrenOfYearAnchor($partOf, $structure) { |
|
| 113 | 110 | $query = $this->createQuery(); |
| 114 | 111 | |
| 115 | 112 | $query->matching($query->equals('structure', $structure)); |
@@ -130,8 +127,7 @@ discard block |
||
| 130 | 127 | * |
| 131 | 128 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
| 132 | 129 | */ |
| 133 | - public function findOneByIdAndSettings($uid, $settings = []) |
|
| 134 | - { |
|
| 130 | + public function findOneByIdAndSettings($uid, $settings = []) { |
|
| 135 | 131 | $settings = ['documentSets' => $uid]; |
| 136 | 132 | |
| 137 | 133 | return $this->findDocumentsBySettings($settings)->getFirst(); |
@@ -144,8 +140,7 @@ discard block |
||
| 144 | 140 | * |
| 145 | 141 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
| 146 | 142 | */ |
| 147 | - public function findDocumentsBySettings($settings = []) |
|
| 148 | - { |
|
| 143 | + public function findDocumentsBySettings($settings = []) { |
|
| 149 | 144 | $query = $this->createQuery(); |
| 150 | 145 | |
| 151 | 146 | $constraints = []; |
@@ -175,8 +170,7 @@ discard block |
||
| 175 | 170 | * |
| 176 | 171 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
| 177 | 172 | */ |
| 178 | - public function findAllByCollectionsLimited($collections, $limit = 50) |
|
| 179 | - { |
|
| 173 | + public function findAllByCollectionsLimited($collections, $limit = 50) { |
|
| 180 | 174 | $query = $this->createQuery(); |
| 181 | 175 | |
| 182 | 176 | // order by start_date -> start_time... |
@@ -213,8 +207,7 @@ discard block |
||
| 213 | 207 | * |
| 214 | 208 | * @return array |
| 215 | 209 | */ |
| 216 | - public function getStatisticsForSelectedCollection($settings) |
|
| 217 | - { |
|
| 210 | + public function getStatisticsForSelectedCollection($settings) { |
|
| 218 | 211 | if ($settings['collections']) { |
| 219 | 212 | // Include only selected collections. |
| 220 | 213 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -348,8 +341,7 @@ discard block |
||
| 348 | 341 | * |
| 349 | 342 | * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
| 350 | 343 | */ |
| 351 | - public function getTableOfContentsFromDb($uid, $pid, $settings) |
|
| 352 | - { |
|
| 344 | + public function getTableOfContentsFromDb($uid, $pid, $settings) { |
|
| 353 | 345 | // Build table of contents from database. |
| 354 | 346 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 355 | 347 | ->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -397,8 +389,7 @@ discard block |
||
| 397 | 389 | * |
| 398 | 390 | * @return array The found document object |
| 399 | 391 | */ |
| 400 | - public function getOaiRecord($settings, $parameters) |
|
| 401 | - { |
|
| 392 | + public function getOaiRecord($settings, $parameters) { |
|
| 402 | 393 | $where = ''; |
| 403 | 394 | |
| 404 | 395 | if (!$settings['show_userdefined']) { |
@@ -438,8 +429,7 @@ discard block |
||
| 438 | 429 | * |
| 439 | 430 | * @return array The found document objects |
| 440 | 431 | */ |
| 441 | - public function getOaiDocumentList($settings, $documentsToProcess) |
|
| 442 | - { |
|
| 432 | + public function getOaiDocumentList($settings, $documentsToProcess) { |
|
| 443 | 433 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
| 444 | 434 | ->getConnectionForTable('tx_dlf_documents'); |
| 445 | 435 | |
@@ -474,8 +464,7 @@ discard block |
||
| 474 | 464 | * |
| 475 | 465 | * @return array |
| 476 | 466 | */ |
| 477 | - public function findAllByUids($uids, $checkPartof = false) |
|
| 478 | - { |
|
| 467 | + public function findAllByUids($uids, $checkPartof = false) { |
|
| 479 | 468 | // get all documents from db we are talking about |
| 480 | 469 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
| 481 | 470 | $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -524,8 +513,7 @@ discard block |
||
| 524 | 513 | * |
| 525 | 514 | * @return array |
| 526 | 515 | */ |
| 527 | - public function findChildrenOfEach(array $uids) |
|
| 528 | - { |
|
| 516 | + public function findChildrenOfEach(array $uids) { |
|
| 529 | 517 | $allDocuments = $this->findAllByUids($uids, true); |
| 530 | 518 | |
| 531 | 519 | $result = []; |
@@ -546,8 +534,7 @@ discard block |
||
| 546 | 534 | * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata |
| 547 | 535 | * @return array |
| 548 | 536 | */ |
| 549 | - public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) |
|
| 550 | - { |
|
| 537 | + public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) { |
|
| 551 | 538 | // set settings global inside this repository |
| 552 | 539 | // (may be necessary when SolrSearch calls back) |
| 553 | 540 | $this->settings = $settings; |
@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
| 7 | 7 | use TYPO3\CMS\Core\Localization\LanguageService; |
| 8 | 8 | |
| 9 | -class HelperTest extends FunctionalTestCase |
|
| 10 | -{ |
|
| 9 | +class HelperTest extends FunctionalTestCase { |
|
| 11 | 10 | public function setUp(): void |
| 12 | 11 | { |
| 13 | 12 | parent::setUp(); |
@@ -19,8 +18,7 @@ discard block |
||
| 19 | 18 | /** |
| 20 | 19 | * @test |
| 21 | 20 | */ |
| 22 | - public function canGetIndexNameFromUid() |
|
| 23 | - { |
|
| 21 | + public function canGetIndexNameFromUid() { |
|
| 24 | 22 | // Repeat to make sure caching isn't broken |
| 25 | 23 | for ($n = 0; $n < 2; $n++) { |
| 26 | 24 | // Good UID, no PID |
@@ -69,8 +67,7 @@ discard block |
||
| 69 | 67 | * @test |
| 70 | 68 | * @group getLanguageName |
| 71 | 69 | */ |
| 72 | - public function canTranslateLanguageNameToEnglish() |
|
| 73 | - { |
|
| 70 | + public function canTranslateLanguageNameToEnglish() { |
|
| 74 | 71 | // NOTE: This only tests in BE mode |
| 75 | 72 | |
| 76 | 73 | $this->initLanguageService('default'); |
@@ -84,8 +81,7 @@ discard block |
||
| 84 | 81 | * @test |
| 85 | 82 | * @group getLanguageName |
| 86 | 83 | */ |
| 87 | - public function canTranslateLanguageNameToGerman() |
|
| 88 | - { |
|
| 84 | + public function canTranslateLanguageNameToGerman() { |
|
| 89 | 85 | // NOTE: This only tests in BE mode |
| 90 | 86 | |
| 91 | 87 | $this->initLanguageService('de'); |
@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | use Kitodo\Dlf\Common\Doc; |
| 6 | 6 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
| 7 | 7 | |
| 8 | -class MetsDocumentTest extends FunctionalTestCase |
|
| 9 | -{ |
|
| 8 | +class MetsDocumentTest extends FunctionalTestCase { |
|
| 10 | 9 | public function setUp(): void |
| 11 | 10 | { |
| 12 | 11 | parent::setUp(); |
@@ -15,8 +14,7 @@ discard block |
||
| 15 | 14 | $this->importDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.xml'); |
| 16 | 15 | } |
| 17 | 16 | |
| 18 | - protected function doc(string $file) |
|
| 19 | - { |
|
| 17 | + protected function doc(string $file) { |
|
| 20 | 18 | $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file; |
| 21 | 19 | $doc = Doc::getInstance($url); |
| 22 | 20 | $this->assertNotNull($doc); |
@@ -26,8 +24,7 @@ discard block |
||
| 26 | 24 | /** |
| 27 | 25 | * @test |
| 28 | 26 | */ |
| 29 | - public function canParseDmdAndAmdSec() |
|
| 30 | - { |
|
| 27 | + public function canParseDmdAndAmdSec() { |
|
| 31 | 28 | $doc = $this->doc('av_beispiel.xml'); |
| 32 | 29 | |
| 33 | 30 | $titledata = $doc->getTitledata(20000); |
@@ -45,8 +42,7 @@ discard block |
||
| 45 | 42 | /** |
| 46 | 43 | * @test |
| 47 | 44 | */ |
| 48 | - public function canReadFileMetadata() |
|
| 49 | - { |
|
| 45 | + public function canReadFileMetadata() { |
|
| 50 | 46 | $doc = $this->doc('av_beispiel.xml'); |
| 51 | 47 | |
| 52 | 48 | $thumbsMeta = $doc->getMetadata('FILE_0000_THUMBS', 20000); |
@@ -61,8 +57,7 @@ discard block |
||
| 61 | 57 | /** |
| 62 | 58 | * @test |
| 63 | 59 | */ |
| 64 | - public function canGetLogicalStructure() |
|
| 65 | - { |
|
| 60 | + public function canGetLogicalStructure() { |
|
| 66 | 61 | $doc = $this->doc('av_beispiel.xml'); |
| 67 | 62 | |
| 68 | 63 | $toc = $doc->tableOfContents[0] ?? []; |
@@ -98,8 +93,7 @@ discard block |
||
| 98 | 93 | /** |
| 99 | 94 | * @test |
| 100 | 95 | */ |
| 101 | - public function doesNotOverwriteFirstDmdSec() |
|
| 102 | - { |
|
| 96 | + public function doesNotOverwriteFirstDmdSec() { |
|
| 103 | 97 | $doc = $this->doc('two_dmdsec.xml'); |
| 104 | 98 | |
| 105 | 99 | $titledata = $doc->getTitledata(20000); |
@@ -112,8 +106,7 @@ discard block |
||
| 112 | 106 | /** |
| 113 | 107 | * @test |
| 114 | 108 | */ |
| 115 | - public function returnsEmptyMetadataWhenNoDmdSec() |
|
| 116 | - { |
|
| 109 | + public function returnsEmptyMetadataWhenNoDmdSec() { |
|
| 117 | 110 | $doc = $this->doc('two_dmdsec.xml'); |
| 118 | 111 | |
| 119 | 112 | // DMD and AMD works |
@@ -67,8 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | protected $httpClient; |
| 69 | 69 | |
| 70 | - public function __construct() |
|
| 71 | - { |
|
| 70 | + public function __construct() { |
|
| 72 | 71 | parent::__construct(); |
| 73 | 72 | |
| 74 | 73 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
@@ -95,8 +94,7 @@ discard block |
||
| 95 | 94 | $this->addSiteConfig('dlf-testing', $this->baseUrl); |
| 96 | 95 | } |
| 97 | 96 | |
| 98 | - protected function getDlfConfiguration() |
|
| 99 | - { |
|
| 97 | + protected function getDlfConfiguration() { |
|
| 100 | 98 | return [ |
| 101 | 99 | 'fileGrpImages' => 'DEFAULT,MAX', |
| 102 | 100 | 'fileGrpThumbs' => 'THUMBS', |
@@ -134,8 +132,7 @@ discard block |
||
| 134 | 132 | ]; |
| 135 | 133 | } |
| 136 | 134 | |
| 137 | - protected function addSiteConfig($identifier, $baseUrl) |
|
| 138 | - { |
|
| 135 | + protected function addSiteConfig($identifier, $baseUrl) { |
|
| 139 | 136 | $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
| 140 | 137 | $siteConfig['base'] = $baseUrl; |
| 141 | 138 | $siteConfig['languages'][0]['base'] = $baseUrl; |
@@ -145,8 +142,7 @@ discard block |
||
| 145 | 142 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
| 146 | 143 | } |
| 147 | 144 | |
| 148 | - protected function initializeRepository(string $className, int $storagePid) |
|
| 149 | - { |
|
| 145 | + protected function initializeRepository(string $className, int $storagePid) { |
|
| 150 | 146 | $repository = $this->objectManager->get($className); |
| 151 | 147 | |
| 152 | 148 | $querySettings = $this->objectManager->get(Typo3QuerySettings::class); |
@@ -156,8 +152,7 @@ discard block |
||
| 156 | 152 | return $repository; |
| 157 | 153 | } |
| 158 | 154 | |
| 159 | - protected function importSolrDocuments(Solr $solr, string $path) |
|
| 160 | - { |
|
| 155 | + protected function importSolrDocuments(Solr $solr, string $path) { |
|
| 161 | 156 | $jsonDocuments = json_decode(file_get_contents($path), true); |
| 162 | 157 | |
| 163 | 158 | $updateQuery = $solr->service->createUpdate(); |
@@ -176,8 +171,7 @@ discard block |
||
| 176 | 171 | $solr->service->update($updateQuery); |
| 177 | 172 | } |
| 178 | 173 | |
| 179 | - protected function initLanguageService(string $locale) |
|
| 180 | - { |
|
| 174 | + protected function initLanguageService(string $locale) { |
|
| 181 | 175 | if (class_exists(\TYPO3\CMS\Core\Localization\LanguageServiceFactory::class)) { |
| 182 | 176 | $GLOBALS['LANG'] = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageServiceFactory::class)->create($locale); |
| 183 | 177 | } else { |
@@ -193,8 +187,7 @@ discard block |
||
| 193 | 187 | /** |
| 194 | 188 | * Assert that $sub is recursively contained within $super. |
| 195 | 189 | */ |
| 196 | - protected function assertArrayMatches(array $sub, array $super, string $message = '') |
|
| 197 | - { |
|
| 190 | + protected function assertArrayMatches(array $sub, array $super, string $message = '') { |
|
| 198 | 191 | $this->assertEquals($sub, ArrayUtility::intersectRecursive($super, $sub), $message); |
| 199 | 192 | } |
| 200 | 193 | } |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | * @subpackage dlf |
| 29 | 29 | * @access public |
| 30 | 30 | */ |
| 31 | -class ItemsProcFunc implements LoggerAwareInterface |
|
| 32 | -{ |
|
| 31 | +class ItemsProcFunc implements LoggerAwareInterface { |
|
| 33 | 32 | use LoggerAwareTrait; |
| 34 | 33 | |
| 35 | 34 | /** |
@@ -46,8 +45,7 @@ discard block |
||
| 46 | 45 | * |
| 47 | 46 | * @return void |
| 48 | 47 | */ |
| 49 | - public function toolList(&$params) |
|
| 50 | - { |
|
| 48 | + public function toolList(&$params) { |
|
| 51 | 49 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] as $class => $label) { |
| 52 | 50 | $params['items'][] = [Helper::getLanguageService()->sL($label), $class]; |
| 53 | 51 | } |
@@ -97,8 +95,7 @@ discard block |
||
| 97 | 95 | * |
| 98 | 96 | * @return void |
| 99 | 97 | */ |
| 100 | - public function extendedSearchList(&$params) |
|
| 101 | - { |
|
| 98 | + public function extendedSearchList(&$params) { |
|
| 102 | 99 | $this->generateList( |
| 103 | 100 | $params, |
| 104 | 101 | 'label,index_name', |
@@ -139,8 +136,7 @@ discard block |
||
| 139 | 136 | * |
| 140 | 137 | * @return void |
| 141 | 138 | */ |
| 142 | - protected function generateList(&$params, $fields, $table, $sorting, $andWhere = '') |
|
| 143 | - { |
|
| 139 | + protected function generateList(&$params, $fields, $table, $sorting, $andWhere = '') { |
|
| 144 | 140 | $this->getTyposcriptConfigFromPluginSiteRoot($params); |
| 145 | 141 | |
| 146 | 142 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |