@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 20000); |
| 46 | 46 | $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, 20000); |
| 47 | 47 | |
| 48 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.csv'); |
|
| 49 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/libraries.csv'); |
|
| 50 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/metadata.csv'); |
|
| 48 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/documents_1.csv'); |
|
| 49 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/libraries.csv'); |
|
| 50 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/metadata.csv'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $core = $this->createSolrCore(); |
| 130 | 130 | |
| 131 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/documents_fulltext.csv'); |
|
| 132 | - $this->importSolrDocuments($core->solr, __DIR__ . '/../../Fixtures/Common/documents_1.solr.json'); |
|
| 133 | - $this->importSolrDocuments($core->solr, __DIR__ . '/../../Fixtures/Common/documents_fulltext.solr.json'); |
|
| 131 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/documents_fulltext.csv'); |
|
| 132 | + $this->importSolrDocuments($core->solr, __DIR__.'/../../Fixtures/Common/documents_1.solr.json'); |
|
| 133 | + $this->importSolrDocuments($core->solr, __DIR__.'/../../Fixtures/Common/documents_fulltext.solr.json'); |
|
| 134 | 134 | |
| 135 | 135 | $collections = $this->collectionRepository->findCollectionsBySettings([ |
| 136 | 136 | 'index_name' => ['Musik', 'Projekt: Dresdner Hefte'], |
@@ -23,8 +23,7 @@ discard block |
||
| 23 | 23 | use TYPO3\CMS\Core\Core\Bootstrap; |
| 24 | 24 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
| 25 | 25 | |
| 26 | -class SolrIndexingTest extends FunctionalTestCase |
|
| 27 | -{ |
|
| 26 | +class SolrIndexingTest extends FunctionalTestCase { |
|
| 28 | 27 | /** @var CollectionRepository */ |
| 29 | 28 | protected $collectionRepository; |
| 30 | 29 | |
@@ -53,8 +52,7 @@ discard block |
||
| 53 | 52 | /** |
| 54 | 53 | * @test |
| 55 | 54 | */ |
| 56 | - public function canCreateCore() |
|
| 57 | - { |
|
| 55 | + public function canCreateCore() { |
|
| 58 | 56 | $coreName = uniqid('testCore'); |
| 59 | 57 | $solr = Solr::getInstance($coreName); |
| 60 | 58 | self::assertNull($solr->core); |
@@ -69,8 +67,7 @@ discard block |
||
| 69 | 67 | /** |
| 70 | 68 | * @test |
| 71 | 69 | */ |
| 72 | - public function canIndexAndSearchDocument() |
|
| 73 | - { |
|
| 70 | + public function canIndexAndSearchDocument() { |
|
| 74 | 71 | $core = $this->createSolrCore(); |
| 75 | 72 | |
| 76 | 73 | $document = $this->documentRepository->findByUid(1001); |
@@ -124,8 +121,7 @@ discard block |
||
| 124 | 121 | /** |
| 125 | 122 | * @test |
| 126 | 123 | */ |
| 127 | - public function canSearchInCollections() |
|
| 128 | - { |
|
| 124 | + public function canSearchInCollections() { |
|
| 129 | 125 | $core = $this->createSolrCore(); |
| 130 | 126 | |
| 131 | 127 | $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/documents_fulltext.csv'); |
@@ -165,8 +161,7 @@ discard block |
||
| 165 | 161 | /** |
| 166 | 162 | * @test |
| 167 | 163 | */ |
| 168 | - public function canGetIndexFieldName() |
|
| 169 | - { |
|
| 164 | + public function canGetIndexFieldName() { |
|
| 170 | 165 | $this->assertEquals('title_usi', Indexer::getIndexFieldName('title', 20000)); |
| 171 | 166 | $this->assertEquals('year_uuu', Indexer::getIndexFieldName('year', 20000)); |
| 172 | 167 | $this->assertEquals('', Indexer::getIndexFieldName('title')); |
@@ -94,11 +94,11 @@ |
||
| 94 | 94 | self::assertEquals(15, $solrSearch->getNumFound()); |
| 95 | 95 | |
| 96 | 96 | // Check that the title stored in Solr matches the title of database entry |
| 97 | - $docTitleInSolr = false; |
|
| 97 | + $docTitleInSolr = FALSE; |
|
| 98 | 98 | foreach ($solrSearch->getSolrResults()['documents'] as $solrDoc) { |
| 99 | 99 | if ($solrDoc['toplevel'] && intval($solrDoc['uid']) === intval($document->getUid())) { |
| 100 | 100 | self::assertEquals($document->getTitle(), $solrDoc['title']); |
| 101 | - $docTitleInSolr = true; |
|
| 101 | + $docTitleInSolr = TRUE; |
|
| 102 | 102 | break; |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -23,13 +23,13 @@ |
||
| 23 | 23 | private $solrCoreRepository; |
| 24 | 24 | |
| 25 | 25 | private static array $databaseFixtures = [ |
| 26 | - __DIR__ . '/../../Fixtures/Common/documents_1.csv', |
|
| 27 | - __DIR__ . '/../../Fixtures/Common/pages.csv', |
|
| 28 | - __DIR__ . '/../../Fixtures/Common/solrcores.csv' |
|
| 26 | + __DIR__.'/../../Fixtures/Common/documents_1.csv', |
|
| 27 | + __DIR__.'/../../Fixtures/Common/pages.csv', |
|
| 28 | + __DIR__.'/../../Fixtures/Common/solrcores.csv' |
|
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | 31 | private static array $solrFixtures = [ |
| 32 | - __DIR__ . '/../../Fixtures/Common/documents_1.solr.json' |
|
| 32 | + __DIR__.'/../../Fixtures/Common/documents_1.solr.json' |
|
| 33 | 33 | ]; |
| 34 | 34 | |
| 35 | 35 | public function setUp(): void |
@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | use Kitodo\Dlf\Domain\Repository\SolrCoreRepository; |
| 19 | 19 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
| 20 | 20 | |
| 21 | -class SolrSearchQueryTest extends FunctionalTestCase |
|
| 22 | -{ |
|
| 21 | +class SolrSearchQueryTest extends FunctionalTestCase { |
|
| 23 | 22 | private $solrCoreRepository; |
| 24 | 23 | |
| 25 | 24 | private static array $databaseFixtures = [ |
@@ -43,8 +42,7 @@ discard block |
||
| 43 | 42 | * @test |
| 44 | 43 | * @ignore |
| 45 | 44 | */ |
| 46 | - public function canExecute() |
|
| 47 | - { |
|
| 45 | + public function canExecute() { |
|
| 48 | 46 | $documentRepository = $this->initializeRepository(DocumentRepository::class, 0); |
| 49 | 47 | $settings = ['solrcore' => 4, 'storagePid' => 0]; |
| 50 | 48 | |
@@ -68,8 +66,7 @@ discard block |
||
| 68 | 66 | $this->initializeRepository(DocumentRepository::class, 0); |
| 69 | 67 | } |
| 70 | 68 | |
| 71 | - protected function setUpSolr($uid, $storagePid, $solrFixtures) |
|
| 72 | - { |
|
| 69 | + protected function setUpSolr($uid, $storagePid, $solrFixtures) { |
|
| 73 | 70 | $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid); |
| 74 | 71 | |
| 75 | 72 | // Setup Solr only once for all tests in this suite |
@@ -73,9 +73,9 @@ |
||
| 73 | 73 | $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid); |
| 74 | 74 | |
| 75 | 75 | // Setup Solr only once for all tests in this suite |
| 76 | - static $solr = null; |
|
| 76 | + static $solr = NULL; |
|
| 77 | 77 | |
| 78 | - if ($solr === null) { |
|
| 78 | + if ($solr === NULL) { |
|
| 79 | 79 | $coreName = Solr::createCore(); |
| 80 | 80 | $solr = Solr::getInstance($coreName); |
| 81 | 81 | foreach ($solrFixtures as $filePath) { |
@@ -21,13 +21,13 @@ |
||
| 21 | 21 | { |
| 22 | 22 | |
| 23 | 23 | private static array $databaseFixtures = [ |
| 24 | - __DIR__ . '/../../Fixtures/Common/documents_1.csv', |
|
| 25 | - __DIR__ . '/../../Fixtures/Common/pages.csv', |
|
| 26 | - __DIR__ . '/../../Fixtures/Common/solrcores.csv' |
|
| 24 | + __DIR__.'/../../Fixtures/Common/documents_1.csv', |
|
| 25 | + __DIR__.'/../../Fixtures/Common/pages.csv', |
|
| 26 | + __DIR__.'/../../Fixtures/Common/solrcores.csv' |
|
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | 29 | private static array $solrFixtures = [ |
| 30 | - __DIR__ . '/../../Fixtures/Common/documents_1.solr.json' |
|
| 30 | + __DIR__.'/../../Fixtures/Common/documents_1.solr.json' |
|
| 31 | 31 | ]; |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | use Kitodo\Dlf\Domain\Repository\SolrCoreRepository; |
| 18 | 18 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
| 19 | 19 | |
| 20 | -class SolrTest extends FunctionalTestCase |
|
| 21 | -{ |
|
| 20 | +class SolrTest extends FunctionalTestCase { |
|
| 22 | 21 | |
| 23 | 22 | private static array $databaseFixtures = [ |
| 24 | 23 | __DIR__ . '/../../Fixtures/Common/documents_1.csv', |
@@ -33,8 +32,7 @@ discard block |
||
| 33 | 32 | /** |
| 34 | 33 | * @test |
| 35 | 34 | */ |
| 36 | - public function canCreateCore() |
|
| 37 | - { |
|
| 35 | + public function canCreateCore() { |
|
| 38 | 36 | $this->assertEquals('newCoreName', Solr::createCore('newCoreName')); |
| 39 | 37 | $this->assertEquals('newCoreName', Solr::getInstance('newCoreName')->core); |
| 40 | 38 | } |
@@ -42,8 +40,7 @@ discard block |
||
| 42 | 40 | /** |
| 43 | 41 | * @test |
| 44 | 42 | */ |
| 45 | - public function canEscapeQuery() |
|
| 46 | - { |
|
| 43 | + public function canEscapeQuery() { |
|
| 47 | 44 | $query1 = Solr::escapeQuery('"custom query with special characters: "testvalue"\n"'); |
| 48 | 45 | $this->assertEquals('"custom query with special characters\: "testvalue"\\\\n"', $query1); |
| 49 | 46 | |
@@ -54,8 +51,7 @@ discard block |
||
| 54 | 51 | /** |
| 55 | 52 | * @test |
| 56 | 53 | */ |
| 57 | - public function canEscapeQueryKeepField() |
|
| 58 | - { |
|
| 54 | + public function canEscapeQueryKeepField() { |
|
| 59 | 55 | $query1 = Solr::escapeQueryKeepField('abc_uui:(abc)', 0); |
| 60 | 56 | $this->assertEquals('abc_uui\:(abc)', $query1); |
| 61 | 57 | } |
@@ -63,8 +59,7 @@ discard block |
||
| 63 | 59 | /** |
| 64 | 60 | * @test |
| 65 | 61 | */ |
| 66 | - public function canGetNextCoreNumber() |
|
| 67 | - { |
|
| 62 | + public function canGetNextCoreNumber() { |
|
| 68 | 63 | $this->assertEquals(5, Solr::getNextCoreNumber()); |
| 69 | 64 | $this->assertEquals(5, Solr::getNextCoreNumber()); |
| 70 | 65 | Solr::createCore(); |
@@ -74,8 +69,7 @@ discard block |
||
| 74 | 69 | /** |
| 75 | 70 | * @test |
| 76 | 71 | */ |
| 77 | - public function canSearchRaw() |
|
| 78 | - { |
|
| 72 | + public function canSearchRaw() { |
|
| 79 | 73 | $this->setUpData(self::$databaseFixtures); |
| 80 | 74 | $solr = $this->setUpSolr(4, 0, self::$solrFixtures); |
| 81 | 75 | $resultSet = $solr->searchRaw(['core' => 4, 'collection' => 1]); |
@@ -92,8 +86,7 @@ discard block |
||
| 92 | 86 | $this->initializeRepository(DocumentRepository::class, 0); |
| 93 | 87 | } |
| 94 | 88 | |
| 95 | - protected function setUpSolr($uid, $storagePid, $solrFixtures) |
|
| 96 | - { |
|
| 89 | + protected function setUpSolr($uid, $storagePid, $solrFixtures) { |
|
| 97 | 90 | $solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid); |
| 98 | 91 | |
| 99 | 92 | // Setup Solr only once for all tests in this suite |
@@ -97,9 +97,9 @@ |
||
| 97 | 97 | $solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid); |
| 98 | 98 | |
| 99 | 99 | // Setup Solr only once for all tests in this suite |
| 100 | - static $solr = null; |
|
| 100 | + static $solr = NULL; |
|
| 101 | 101 | |
| 102 | - if ($solr === null) { |
|
| 102 | + if ($solr === NULL) { |
|
| 103 | 103 | $coreName = Solr::createCore(); |
| 104 | 104 | $solr = Solr::getInstance($coreName); |
| 105 | 105 | foreach ($solrFixtures as $filePath) { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
| 99 | 99 | |
| 100 | 100 | if ($this->disableJsonWrappedResponse) { |
| 101 | - $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) { |
|
| 101 | + $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function($ext) { |
|
| 102 | 102 | return $ext !== 'Resources/Core/Functional/Extensions/json_response'; |
| 103 | 103 | }); |
| 104 | 104 | } |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
| 112 | 112 | $this->persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
| 113 | 113 | |
| 114 | - $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
|
| 114 | + $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-'.$this->identifier.'/'; |
|
| 115 | 115 | $this->httpClient = new HttpClient([ |
| 116 | - 'base_uri' => $this->baseUrl . 'index.php', |
|
| 116 | + 'base_uri' => $this->baseUrl.'index.php', |
|
| 117 | 117 | 'http_errors' => false, |
| 118 | 118 | ]); |
| 119 | 119 | |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | protected function addSiteConfig($identifier) |
| 166 | 166 | { |
| 167 | - $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
|
| 167 | + $siteConfig = Yaml::parseFile(__DIR__.'/../Fixtures/siteconfig.yaml'); |
|
| 168 | 168 | $siteConfig['base'] = $this->baseUrl; |
| 169 | 169 | $siteConfig['languages'][0]['base'] = $this->baseUrl; |
| 170 | 170 | |
| 171 | - $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
|
| 171 | + $siteConfigPath = $this->instancePath.'/typo3conf/sites/'.$identifier; |
|
| 172 | 172 | @mkdir($siteConfigPath, 0775, true); |
| 173 | - file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
|
| 173 | + file_put_contents($siteConfigPath.'/config.yaml', Yaml::dump($siteConfig)); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | protected function initializeRepository(string $className, int $storagePid) |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $jsonDocuments = json_decode(file_get_contents($path), true); |
| 190 | 190 | |
| 191 | 191 | $updateQuery = $solr->service->createUpdate(); |
| 192 | - $documents = array_map(function ($jsonDoc) use ($updateQuery) { |
|
| 192 | + $documents = array_map(function($jsonDoc) use ($updateQuery) { |
|
| 193 | 193 | $document = $updateQuery->createDocument(); |
| 194 | 194 | foreach ($jsonDoc as $key => $value) { |
| 195 | 195 | $document->setField($key, $value); |
@@ -91,8 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | protected $httpClient; |
| 93 | 93 | |
| 94 | - public function __construct() |
|
| 95 | - { |
|
| 94 | + public function __construct() { |
|
| 96 | 95 | parent::__construct(); |
| 97 | 96 | |
| 98 | 97 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
@@ -120,8 +119,7 @@ discard block |
||
| 120 | 119 | $this->addSiteConfig('dlf-testing'); |
| 121 | 120 | } |
| 122 | 121 | |
| 123 | - protected function getDlfConfiguration() |
|
| 124 | - { |
|
| 122 | + protected function getDlfConfiguration() { |
|
| 125 | 123 | $dotenv = Dotenv::createImmutable('/home/runner/work/kitodo-presentation/kitodo-presentation/Build/Test/', 'test.env'); |
| 126 | 124 | $dotenv->load(); |
| 127 | 125 | |
@@ -162,8 +160,7 @@ discard block |
||
| 162 | 160 | ]; |
| 163 | 161 | } |
| 164 | 162 | |
| 165 | - protected function addSiteConfig($identifier) |
|
| 166 | - { |
|
| 163 | + protected function addSiteConfig($identifier) { |
|
| 167 | 164 | $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
| 168 | 165 | $siteConfig['base'] = $this->baseUrl; |
| 169 | 166 | $siteConfig['languages'][0]['base'] = $this->baseUrl; |
@@ -173,8 +170,7 @@ discard block |
||
| 173 | 170 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
| 174 | 171 | } |
| 175 | 172 | |
| 176 | - protected function initializeRepository(string $className, int $storagePid) |
|
| 177 | - { |
|
| 173 | + protected function initializeRepository(string $className, int $storagePid) { |
|
| 178 | 174 | $repository = $this->objectManager->get($className); |
| 179 | 175 | |
| 180 | 176 | $querySettings = $this->objectManager->get(Typo3QuerySettings::class); |
@@ -184,8 +180,7 @@ discard block |
||
| 184 | 180 | return $repository; |
| 185 | 181 | } |
| 186 | 182 | |
| 187 | - protected function importSolrDocuments(Solr $solr, string $path) |
|
| 188 | - { |
|
| 183 | + protected function importSolrDocuments(Solr $solr, string $path) { |
|
| 189 | 184 | $jsonDocuments = json_decode(file_get_contents($path), true); |
| 190 | 185 | |
| 191 | 186 | $updateQuery = $solr->service->createUpdate(); |
@@ -204,16 +199,14 @@ discard block |
||
| 204 | 199 | $solr->service->update($updateQuery); |
| 205 | 200 | } |
| 206 | 201 | |
| 207 | - protected function initLanguageService(string $locale) |
|
| 208 | - { |
|
| 202 | + protected function initLanguageService(string $locale) { |
|
| 209 | 203 | $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->create($locale); |
| 210 | 204 | } |
| 211 | 205 | |
| 212 | 206 | /** |
| 213 | 207 | * Assert that $sub is recursively contained within $super. |
| 214 | 208 | */ |
| 215 | - protected function assertArrayMatches(array $sub, array $super, string $message = '') |
|
| 216 | - { |
|
| 209 | + protected function assertArrayMatches(array $sub, array $super, string $message = '') { |
|
| 217 | 210 | self::assertEquals($sub, ArrayUtility::intersectRecursive($super, $sub), $message); |
| 218 | 211 | } |
| 219 | 212 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ], |
| 50 | 50 | 'FE' => [ |
| 51 | 51 | 'cacheHash' => [ |
| 52 | - 'enforceValidation' => false, |
|
| 52 | + 'enforceValidation' => FALSE, |
|
| 53 | 53 | ], |
| 54 | 54 | ], |
| 55 | 55 | 'DB' => [ |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @var bool |
| 71 | 71 | */ |
| 72 | - protected $disableJsonWrappedResponse = false; |
|
| 72 | + protected $disableJsonWrappedResponse = FALSE; |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @var ObjectManager |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
| 115 | 115 | $this->httpClient = new HttpClient([ |
| 116 | 116 | 'base_uri' => $this->baseUrl . 'index.php', |
| 117 | - 'http_errors' => false, |
|
| 117 | + 'http_errors' => FALSE, |
|
| 118 | 118 | ]); |
| 119 | 119 | |
| 120 | 120 | $this->addSiteConfig('dlf-testing'); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $siteConfig['languages'][0]['base'] = $this->baseUrl; |
| 170 | 170 | |
| 171 | 171 | $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
| 172 | - @mkdir($siteConfigPath, 0775, true); |
|
| 172 | + @mkdir($siteConfigPath, 0775, TRUE); |
|
| 173 | 173 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | protected function importSolrDocuments(Solr $solr, string $path) |
| 188 | 188 | { |
| 189 | - $jsonDocuments = json_decode(file_get_contents($path), true); |
|
| 189 | + $jsonDocuments = json_decode(file_get_contents($path), TRUE); |
|
| 190 | 190 | |
| 191 | 191 | $updateQuery = $solr->service->createUpdate(); |
| 192 | 192 | $documents = array_map(function ($jsonDoc) use ($updateQuery) { |
@@ -31,8 +31,7 @@ |
||
| 31 | 31 | * |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class DeleteCommand extends BaseCommand |
|
| 35 | -{ |
|
| 34 | +class DeleteCommand extends BaseCommand { |
|
| 36 | 35 | |
| 37 | 36 | /** |
| 38 | 37 | * Configure the command by defining the name, options and arguments |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | $document = $this->getDocument($input); |
| 148 | 148 | |
| 149 | - if ($document === null) { |
|
| 149 | + if ($document === NULL) { |
|
| 150 | 150 | $io->info('INFO: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . '. It is probably already deleted from DB.'); |
| 151 | 151 | } else { |
| 152 | 152 | if ($io->isVerbose()) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $io->section('Deleting ' . $input->getOption('doc') . ' on Solr core ' . $solrCoreUid . '.'); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $isDeleted = false; |
|
| 180 | + $isDeleted = FALSE; |
|
| 181 | 181 | if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) { |
| 182 | 182 | $isDeleted = Indexer::delete($input, 'uid', $solrCoreUid); |
| 183 | 183 | |
@@ -206,12 +206,12 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | private function getDocument($input): ?Document |
| 208 | 208 | { |
| 209 | - $document = null; |
|
| 209 | + $document = NULL; |
|
| 210 | 210 | |
| 211 | 211 | if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) { |
| 212 | 212 | $document = $this->documentRepository->findByUid($input->getOption('doc')); |
| 213 | 213 | } elseif (GeneralUtility::isValidUrl($input->getOption('doc'))) { |
| 214 | - $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], true); |
|
| 214 | + $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], TRUE); |
|
| 215 | 215 | |
| 216 | 216 | if ($doc->recordId) { |
| 217 | 217 | $document = $this->documentRepository->findOneByRecordId($doc->recordId); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $this->initializeRepositories((int) $input->getOption('pid')); |
| 85 | 85 | |
| 86 | 86 | if ($this->storagePid == 0) { |
| 87 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 87 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 88 | 88 | return BaseCommand::FAILURE; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 100 | 100 | $outputSolrCores = []; |
| 101 | 101 | foreach ($allSolrCores as $indexName => $uid) { |
| 102 | - $outputSolrCores[] = $uid . ' : ' . $indexName; |
|
| 102 | + $outputSolrCores[] = $uid.' : '.$indexName; |
|
| 103 | 103 | } |
| 104 | 104 | if (empty($outputSolrCores)) { |
| 105 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
| 105 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
| 106 | 106 | return BaseCommand::FAILURE; |
| 107 | 107 | } else { |
| 108 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $outputSolrCores) . "\n"); |
|
| 108 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\n"); |
|
| 109 | 109 | return BaseCommand::FAILURE; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | $document = $this->getDocument($input); |
| 148 | 148 | |
| 149 | 149 | if ($document === null) { |
| 150 | - $io->info('INFO: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . '. It is probably already deleted from DB.'); |
|
| 150 | + $io->info('INFO: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.'. It is probably already deleted from DB.'); |
|
| 151 | 151 | } else { |
| 152 | 152 | if ($io->isVerbose()) { |
| 153 | - $io->section('Deleting ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.'); |
|
| 153 | + $io->section('Deleting '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.'); |
|
| 154 | 154 | } |
| 155 | 155 | $this->documentRepository->remove($document); |
| 156 | 156 | $this->persistenceManager->persistAll(); |
| 157 | 157 | if ($io->isVerbose()) { |
| 158 | - $io->success('Deleted ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.'); |
|
| 158 | + $io->success('Deleted '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.'); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | private function deleteFromSolr($input, $io, $solrCoreUid): void |
| 175 | 175 | { |
| 176 | 176 | if ($io->isVerbose()) { |
| 177 | - $io->section('Deleting ' . $input->getOption('doc') . ' on Solr core ' . $solrCoreUid . '.'); |
|
| 177 | + $io->section('Deleting '.$input->getOption('doc').' on Solr core '.$solrCoreUid.'.'); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $isDeleted = false; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | if ($isDeleted) { |
| 189 | 189 | if ($io->isVerbose()) { |
| 190 | - $io->success('Deleted ' . $input->getOption('doc') . ' on Solr core ' . $solrCoreUid . '.'); |
|
| 190 | + $io->success('Deleted '.$input->getOption('doc').' on Solr core '.$solrCoreUid.'.'); |
|
| 191 | 191 | } |
| 192 | 192 | $io->success('All done!'); |
| 193 | 193 | } else { |
@@ -63,8 +63,7 @@ discard block |
||
| 63 | 63 | * @property-read \SimpleXMLElement $mets this holds the XML file's METS part as \SimpleXMLElement object |
| 64 | 64 | * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available |
| 65 | 65 | */ |
| 66 | -final class MetsDocument extends AbstractDocument |
|
| 67 | -{ |
|
| 66 | +final class MetsDocument extends AbstractDocument { |
|
| 68 | 67 | /** |
| 69 | 68 | * @access protected |
| 70 | 69 | * @var string[] Subsections / tags that may occur within `<mets:amdSec>` |
@@ -397,8 +396,7 @@ discard block |
||
| 397 | 396 | * |
| 398 | 397 | * @return ?string thumbnail or null if not found |
| 399 | 398 | */ |
| 400 | - private function getThumbnail(string $id = '') |
|
| 401 | - { |
|
| 399 | + private function getThumbnail(string $id = '') { |
|
| 402 | 400 | // Load plugin configuration. |
| 403 | 401 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
| 404 | 402 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
@@ -726,8 +724,7 @@ discard block |
||
| 726 | 724 | * |
| 727 | 725 | * @return bool true if extraction successful, false otherwise |
| 728 | 726 | */ |
| 729 | - private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata) |
|
| 730 | - { |
|
| 727 | + private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata) { |
|
| 731 | 728 | // Is this metadata format supported? |
| 732 | 729 | if (!empty($this->formats[$this->mdSec[$dmdId]['type']])) { |
| 733 | 730 | if (!empty($this->formats[$this->mdSec[$dmdId]['type']]['class'])) { |
@@ -759,8 +756,7 @@ discard block |
||
| 759 | 756 | * |
| 760 | 757 | * @return array additional metadata data queried from database |
| 761 | 758 | */ |
| 762 | - private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId) |
|
| 763 | - { |
|
| 759 | + private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId) { |
|
| 764 | 760 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 765 | 761 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
| 766 | 762 | // Get hidden records, too. |
@@ -905,8 +901,7 @@ discard block |
||
| 905 | 901 | /** |
| 906 | 902 | * @see AbstractDocument::getStructureDepth() |
| 907 | 903 | */ |
| 908 | - public function getStructureDepth(string $logId) |
|
| 909 | - { |
|
| 904 | + public function getStructureDepth(string $logId) { |
|
| 910 | 905 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
| 911 | 906 | if (!empty($ancestors)) { |
| 912 | 907 | return count($ancestors); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | $file = $this->getFileInfo($id); |
| 190 | 190 | if ($file['mimeType'] === 'application/vnd.kitodo.iiif') { |
| 191 | - $file['location'] = (strrpos($file['location'], 'info.json') === strlen($file['location']) - 9) ? $file['location'] : (strrpos($file['location'], '/') === strlen($file['location']) ? $file['location'] . 'info.json' : $file['location'] . '/info.json'); |
|
| 191 | + $file['location'] = (strrpos($file['location'], 'info.json') === strlen($file['location']) - 9) ? $file['location'] : (strrpos($file['location'], '/') === strlen($file['location']) ? $file['location'].'info.json' : $file['location'].'/info.json'); |
|
| 192 | 192 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'iiif'); |
| 193 | 193 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 194 | 194 | IiifHelper::setMaxThumbnailHeight($conf['thumbnailHeight']); |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | return $service->getImageUrl(); |
| 199 | 199 | } |
| 200 | 200 | } elseif ($file['mimeType'] === 'application/vnd.netfpx') { |
| 201 | - $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : ''); |
|
| 201 | + $baseURL = $file['location'].(strpos($file['location'], '?') === false ? '?' : ''); |
|
| 202 | 202 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 203 | - return $baseURL . '&CVT=jpeg'; |
|
| 203 | + return $baseURL.'&CVT=jpeg'; |
|
| 204 | 204 | } |
| 205 | 205 | return $file['location']; |
| 206 | 206 | } |
@@ -229,14 +229,14 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function getFileLocation(string $id): string |
| 231 | 231 | { |
| 232 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 232 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 233 | 233 | if ( |
| 234 | 234 | !empty($id) |
| 235 | 235 | && !empty($location) |
| 236 | 236 | ) { |
| 237 | 237 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 238 | 238 | } else { |
| 239 | - $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
|
| 239 | + $this->logger->warning('There is no file node with @ID "'.$id.'"'); |
|
| 240 | 240 | return ''; |
| 241 | 241 | } |
| 242 | 242 | } |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function getFileMimeType(string $id): string |
| 248 | 248 | { |
| 249 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
| 249 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
| 250 | 250 | if ( |
| 251 | 251 | !empty($id) |
| 252 | 252 | && !empty($mimetype) |
| 253 | 253 | ) { |
| 254 | 254 | return (string) $mimetype[0]; |
| 255 | 255 | } else { |
| 256 | - $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
|
| 256 | + $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified'); |
|
| 257 | 257 | return ''; |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | return $this->logicalUnits[$id]; |
| 274 | 274 | } elseif (!empty($id)) { |
| 275 | 275 | // Get specified logical unit. |
| 276 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
| 276 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
| 277 | 277 | } else { |
| 278 | 278 | // Get all logical units at top level. |
| 279 | 279 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $cPid = max($cPid, 0); |
| 462 | 462 | if ($cPid == 0 && ($this->cPid || $this->pid)) { |
| 463 | 463 | // Retain current PID. |
| 464 | - $cPid = $this->cPid ?: $this->pid; |
|
| 464 | + $cPid = $this->cPid ? : $this->pid; |
|
| 465 | 465 | } |
| 466 | 466 | return $cPid; |
| 467 | 467 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | if (isset($this->fileInfos[$id]) || in_array('dmdSec', $metadataSections)) { |
| 529 | 529 | return $metadata; |
| 530 | 530 | } else { |
| 531 | - $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"'); |
|
| 531 | + $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"'); |
|
| 532 | 532 | return []; |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | if (!empty($this->logicalUnits[$id])) { |
| 548 | 548 | return [$this->logicalUnits[$id]['type']]; |
| 549 | 549 | } else { |
| 550 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
| 550 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
| 551 | 551 | if (!empty($struct)) { |
| 552 | 552 | return [(string) $struct[0]]; |
| 553 | 553 | } |
@@ -690,13 +690,13 @@ discard block |
||
| 690 | 690 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) { |
| 691 | 691 | $values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode); |
| 692 | 692 | if ($values instanceof \DOMNodeList && $values->length > 0) { |
| 693 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 693 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 694 | 694 | } elseif (!($values instanceof \DOMNodeList)) { |
| 695 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
|
| 695 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
|
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
| 699 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 698 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
| 699 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 700 | 700 | } |
| 701 | 701 | } |
| 702 | 702 | } |
@@ -756,11 +756,11 @@ discard block |
||
| 756 | 756 | return true; |
| 757 | 757 | } |
| 758 | 758 | } else { |
| 759 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
|
| 759 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"'); |
|
| 760 | 760 | } |
| 761 | 761 | } |
| 762 | 762 | } else { |
| 763 | - $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
|
| 763 | + $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"'); |
|
| 764 | 764 | } |
| 765 | 765 | return false; |
| 766 | 766 | } |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? ''; |
| 868 | 868 | $admIds = $this->logicalUnits[$id]['admId'] ?? ''; |
| 869 | 869 | } else { |
| 870 | - $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0]; |
|
| 870 | + $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0]; |
|
| 871 | 871 | if ($mdSec) { |
| 872 | 872 | $dmdIds = (string) $mdSec->attributes()->DMDID; |
| 873 | 873 | $admIds = (string) $mdSec->attributes()->ADMID; |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | |
| 898 | 898 | return array_filter( |
| 899 | 899 | $allMdIds, |
| 900 | - function ($element) { |
|
| 900 | + function($element) { |
|
| 901 | 901 | return !empty($element); |
| 902 | 902 | } |
| 903 | 903 | ); |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | */ |
| 924 | 924 | public function getStructureDepth(string $logId) |
| 925 | 925 | { |
| 926 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
| 926 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
| 927 | 927 | if (!empty($ancestors)) { |
| 928 | 928 | return count($ancestors); |
| 929 | 929 | } else { |
@@ -947,9 +947,9 @@ discard block |
||
| 947 | 947 | $this->registerNamespaces($this->mets); |
| 948 | 948 | } else { |
| 949 | 949 | if (!empty($location)) { |
| 950 | - $this->logger->error('No METS part found in document with location "' . $location . '".'); |
|
| 950 | + $this->logger->error('No METS part found in document with location "'.$location.'".'); |
|
| 951 | 951 | } elseif (!empty($this->recordId)) { |
| 952 | - $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".'); |
|
| 952 | + $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".'); |
|
| 953 | 953 | } else { |
| 954 | 954 | $this->logger->error('No METS part found in current document.'); |
| 955 | 955 | } |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | return true; |
| 971 | 971 | } |
| 972 | 972 | } |
| 973 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
| 973 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
| 974 | 974 | return false; |
| 975 | 975 | } |
| 976 | 976 | |
@@ -1093,10 +1093,10 @@ discard block |
||
| 1093 | 1093 | |
| 1094 | 1094 | if (!empty($mdType) && !empty($this->formats[(string) $mdType[0]])) { |
| 1095 | 1095 | $type = (string) $mdType[0]; |
| 1096 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1096 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1097 | 1097 | } elseif (!empty($otherMdType) && !empty($this->formats[(string) $otherMdType[0]])) { |
| 1098 | 1098 | $type = (string) $otherMdType[0]; |
| 1099 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1099 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | if (empty($xml)) { |
@@ -1289,9 +1289,9 @@ discard block |
||
| 1289 | 1289 | || $forceReload |
| 1290 | 1290 | ) { |
| 1291 | 1291 | // Retain current PID. |
| 1292 | - $cPid = $this->cPid ?: $this->pid; |
|
| 1292 | + $cPid = $this->cPid ? : $this->pid; |
|
| 1293 | 1293 | if (!$cPid) { |
| 1294 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
| 1294 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
| 1295 | 1295 | $this->thumbnailLoaded = true; |
| 1296 | 1296 | return $this->thumbnail; |
| 1297 | 1297 | } |
@@ -1328,7 +1328,7 @@ discard block |
||
| 1328 | 1328 | if (!empty($resArray['thumbnail'])) { |
| 1329 | 1329 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
| 1330 | 1330 | // Check if this document has a structure element of the desired type. |
| 1331 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
| 1331 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
| 1332 | 1332 | if (!empty($strctIds)) { |
| 1333 | 1333 | $strctId = (string) $strctIds[0]; |
| 1334 | 1334 | } |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | } |
| 1352 | 1352 | } |
| 1353 | 1353 | } else { |
| 1354 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
| 1354 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
| 1355 | 1355 | } |
| 1356 | 1356 | $this->thumbnailLoaded = true; |
| 1357 | 1357 | } |
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | { |
| 1398 | 1398 | if (empty($this->parentHref)) { |
| 1399 | 1399 | // Get the closest ancestor of the current document which has a MPTR child. |
| 1400 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 1400 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 1401 | 1401 | if (!empty($parentMptr)) { |
| 1402 | 1402 | $this->parentHref = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 1403 | 1403 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @see MetsDocument::$mdSec |
| 102 | 102 | */ |
| 103 | - protected bool $mdSecLoaded = false; |
|
| 103 | + protected bool $mdSecLoaded = FALSE; |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * @access protected |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * |
| 123 | 123 | * @see $fileGrps |
| 124 | 124 | */ |
| 125 | - protected bool $fileGrpsLoaded = false; |
|
| 125 | + protected bool $fileGrpsLoaded = FALSE; |
|
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @access protected |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | return $service->getImageUrl(); |
| 199 | 199 | } |
| 200 | 200 | } elseif ($file['mimeType'] === 'application/vnd.netfpx') { |
| 201 | - $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : ''); |
|
| 201 | + $baseURL = $file['location'] . (strpos($file['location'], '?') === FALSE ? '?' : ''); |
|
| 202 | 202 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 203 | 203 | return $baseURL . '&CVT=jpeg'; |
| 204 | 204 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $this->fileInfos[$id]['mimeType'] = $this->getFileMimeType($id); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - return $this->fileInfos[$id] ?? null; |
|
| 224 | + return $this->fileInfos[$id] ?? NULL; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | /** |
| 262 | 262 | * @see AbstractDocument::getLogicalStructure() |
| 263 | 263 | */ |
| 264 | - public function getLogicalStructure(string $id, bool $recursive = false): array |
|
| 264 | + public function getLogicalStructure(string $id, bool $recursive = FALSE): array |
|
| 265 | 265 | { |
| 266 | 266 | $details = []; |
| 267 | 267 | // Is the requested logical unit already loaded? |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * |
| 303 | 303 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 304 | 304 | */ |
| 305 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, bool $recursive = false): array |
|
| 305 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, bool $recursive = FALSE): array |
|
| 306 | 306 | { |
| 307 | 307 | $attributes = $structure->attributes(); |
| 308 | 308 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | 'pagination' => '', |
| 321 | 321 | 'type' => isset($attributes['TYPE']) ? (string) $attributes['TYPE'] : '', |
| 322 | 322 | 'description' => '', |
| 323 | - 'thumbnailId' => null, |
|
| 323 | + 'thumbnailId' => NULL, |
|
| 324 | 324 | 'files' => [], |
| 325 | 325 | ]; |
| 326 | 326 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | && array_key_exists($details['id'], $this->smLinks['l2p']) |
| 352 | 352 | ) { |
| 353 | 353 | // Link logical structure to the first corresponding physical page/track. |
| 354 | - $details['points'] = max((int) array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true), 1); |
|
| 354 | + $details['points'] = max((int) array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE), 1); |
|
| 355 | 355 | $details['thumbnailId'] = $this->getThumbnail(); |
| 356 | 356 | // Get page/track number of the first page/track related to this structure element. |
| 357 | 357 | $details['pagination'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['orderlabel']; |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | $details['points'] = 1; |
| 361 | 361 | $details['thumbnailId'] = $this->getThumbnail(); |
| 362 | 362 | } |
| 363 | - if ($details['thumbnailId'] === null) { |
|
| 363 | + if ($details['thumbnailId'] === NULL) { |
|
| 364 | 364 | unset($details['thumbnailId']); |
| 365 | 365 | } |
| 366 | 366 | // Get the files this structure element is pointing at. |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | $details['children'] = []; |
| 383 | 383 | foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) { |
| 384 | 384 | // Repeat for all children. |
| 385 | - $details['children'][] = $this->getLogicalStructureInfo($child, true); |
|
| 385 | + $details['children'][] = $this->getLogicalStructureInfo($child, TRUE); |
|
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | return $details; |
@@ -403,14 +403,14 @@ discard block |
||
| 403 | 403 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
| 404 | 404 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
| 405 | 405 | |
| 406 | - $thumbnail = null; |
|
| 406 | + $thumbnail = NULL; |
|
| 407 | 407 | |
| 408 | 408 | while ($fileGrpThumb = array_shift($fileGrpsThumb)) { |
| 409 | 409 | if (empty($id)) { |
| 410 | - $thumbnail = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb] ?? null; |
|
| 410 | + $thumbnail = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb] ?? NULL; |
|
| 411 | 411 | } else { |
| 412 | - $parentId = $this->smLinks['l2p'][$id][0] ?? null; |
|
| 413 | - $thumbnail = $this->physicalStructureInfo[$parentId]['files'][$fileGrpThumb] ?? null; |
|
| 412 | + $parentId = $this->smLinks['l2p'][$id][0] ?? NULL; |
|
| 413 | + $thumbnail = $this->physicalStructureInfo[$parentId]['files'][$fileGrpThumb] ?? NULL; |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | if (!empty($thumbnail)) { |
@@ -571,13 +571,13 @@ discard block |
||
| 571 | 571 | private function extractAndProcessMetadata(string $dmdId, string $mdSectionType, array &$metadata, int $cPid, array $metadataSections): bool |
| 572 | 572 | { |
| 573 | 573 | if ($this->hasMetadataSection($metadataSections, $mdSectionType, 'dmdSec')) { |
| 574 | - return true; |
|
| 574 | + return TRUE; |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | $metadataExtracted = $this->extractMetadataIfTypeSupported($dmdId, $mdSectionType, $metadata); |
| 578 | 578 | |
| 579 | 579 | if (!$metadataExtracted) { |
| 580 | - return false; |
|
| 580 | + return FALSE; |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | $additionalMetadata = $this->getAdditionalMetadataFromDatabase($cPid, $dmdId); |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | $this->processAdditionalMetadata($additionalMetadata, $domXPath, $domNode, $metadata); |
| 590 | 590 | |
| 591 | - return true; |
|
| 591 | + return TRUE; |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | /** |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | $obj = GeneralUtility::makeInstance($class); |
| 754 | 754 | if ($obj instanceof MetadataInterface) { |
| 755 | 755 | $obj->extractMetadata($this->mdSec[$dmdId]['xml'], $metadata, GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'general')['useExternalApisForMetadata']); |
| 756 | - return true; |
|
| 756 | + return TRUE; |
|
| 757 | 757 | } |
| 758 | 758 | } else { |
| 759 | 759 | $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | } else { |
| 763 | 763 | $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
| 764 | 764 | } |
| 765 | - return false; |
|
| 765 | + return FALSE; |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | /** |
@@ -962,16 +962,16 @@ discard block |
||
| 962 | 962 | protected function loadLocation(string $location): bool |
| 963 | 963 | { |
| 964 | 964 | $fileResource = Helper::getUrl($location); |
| 965 | - if ($fileResource !== false) { |
|
| 965 | + if ($fileResource !== FALSE) { |
|
| 966 | 966 | $xml = Helper::getXmlFileAsString($fileResource); |
| 967 | 967 | // Set some basic properties. |
| 968 | - if ($xml !== false) { |
|
| 968 | + if ($xml !== FALSE) { |
|
| 969 | 969 | $this->xml = $xml; |
| 970 | - return true; |
|
| 970 | + return TRUE; |
|
| 971 | 971 | } |
| 972 | 972 | } |
| 973 | 973 | $this->logger->error('Could not load XML file from "' . $location . '"'); |
| 974 | - return false; |
|
| 974 | + return FALSE; |
|
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | /** |
@@ -993,9 +993,9 @@ discard block |
||
| 993 | 993 | |
| 994 | 994 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 995 | 995 | $this->xml = $preloadedDocument; |
| 996 | - return true; |
|
| 996 | + return TRUE; |
|
| 997 | 997 | } |
| 998 | - return false; |
|
| 998 | + return FALSE; |
|
| 999 | 999 | } |
| 1000 | 1000 | |
| 1001 | 1001 | /** |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | foreach ($this->mets->xpath('./mets:dmdSec') as $dmdSecTag) { |
| 1022 | 1022 | $dmdSec = $this->processMdSec($dmdSecTag); |
| 1023 | 1023 | |
| 1024 | - if ($dmdSec !== null) { |
|
| 1024 | + if ($dmdSec !== NULL) { |
|
| 1025 | 1025 | $this->mdSec[$dmdSec['id']] = $dmdSec; |
| 1026 | 1026 | $this->dmdSec[$dmdSec['id']] = $dmdSec; |
| 1027 | 1027 | } |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | // TODO: Should we check that the format may occur within this type (e.g., to ignore VIDEOMD within rightsMD)? |
| 1039 | 1039 | $mdSec = $this->processMdSec($mdSecTag); |
| 1040 | 1040 | |
| 1041 | - if ($mdSec !== null) { |
|
| 1041 | + if ($mdSec !== NULL) { |
|
| 1042 | 1042 | $this->mdSec[$mdSec['id']] = $mdSec; |
| 1043 | 1043 | |
| 1044 | 1044 | $childIds[] = $mdSec['id']; |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | } |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | - $this->mdSecLoaded = true; |
|
| 1054 | + $this->mdSecLoaded = TRUE; |
|
| 1055 | 1055 | } |
| 1056 | 1056 | return $this->mdSec; |
| 1057 | 1057 | } |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | { |
| 1083 | 1083 | $mdId = (string) $element->attributes()->ID; |
| 1084 | 1084 | if (empty($mdId)) { |
| 1085 | - return null; |
|
| 1085 | + return NULL; |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | $this->registerNamespaces($element); |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | if (empty($xml)) { |
| 1103 | - return null; |
|
| 1103 | + return NULL; |
|
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | $this->registerNamespaces($xml[0]); |
@@ -1161,9 +1161,9 @@ discard block |
||
| 1161 | 1161 | !empty($extConf['fileGrpFulltext']) |
| 1162 | 1162 | && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== [] |
| 1163 | 1163 | ) { |
| 1164 | - $this->hasFulltext = true; |
|
| 1164 | + $this->hasFulltext = TRUE; |
|
| 1165 | 1165 | } |
| 1166 | - $this->fileGrpsLoaded = true; |
|
| 1166 | + $this->fileGrpsLoaded = TRUE; |
|
| 1167 | 1167 | } |
| 1168 | 1168 | return $this->fileGrps; |
| 1169 | 1169 | } |
@@ -1256,7 +1256,7 @@ discard block |
||
| 1256 | 1256 | array_unshift($elements, $id); |
| 1257 | 1257 | $this->physicalStructure = $elements; |
| 1258 | 1258 | } |
| 1259 | - $this->physicalStructureLoaded = true; |
|
| 1259 | + $this->physicalStructureLoaded = TRUE; |
|
| 1260 | 1260 | } |
| 1261 | 1261 | return $this->physicalStructure; |
| 1262 | 1262 | } |
@@ -1274,7 +1274,7 @@ discard block |
||
| 1274 | 1274 | $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from; |
| 1275 | 1275 | } |
| 1276 | 1276 | } |
| 1277 | - $this->smLinksLoaded = true; |
|
| 1277 | + $this->smLinksLoaded = TRUE; |
|
| 1278 | 1278 | } |
| 1279 | 1279 | return $this->smLinks; |
| 1280 | 1280 | } |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | /** |
| 1283 | 1283 | * @see AbstractDocument::magicGetThumbnail() |
| 1284 | 1284 | */ |
| 1285 | - protected function magicGetThumbnail(bool $forceReload = false): string |
|
| 1285 | + protected function magicGetThumbnail(bool $forceReload = FALSE): string |
|
| 1286 | 1286 | { |
| 1287 | 1287 | if ( |
| 1288 | 1288 | !$this->thumbnailLoaded |
@@ -1292,14 +1292,14 @@ discard block |
||
| 1292 | 1292 | $cPid = $this->cPid ?: $this->pid; |
| 1293 | 1293 | if (!$cPid) { |
| 1294 | 1294 | $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
| 1295 | - $this->thumbnailLoaded = true; |
|
| 1295 | + $this->thumbnailLoaded = TRUE; |
|
| 1296 | 1296 | return $this->thumbnail; |
| 1297 | 1297 | } |
| 1298 | 1298 | // Load extension configuration. |
| 1299 | 1299 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
| 1300 | 1300 | if (empty($extConf['fileGrpThumbs'])) { |
| 1301 | 1301 | $this->logger->warning('No fileGrp for thumbnails specified'); |
| 1302 | - $this->thumbnailLoaded = true; |
|
| 1302 | + $this->thumbnailLoaded = TRUE; |
|
| 1303 | 1303 | return $this->thumbnail; |
| 1304 | 1304 | } |
| 1305 | 1305 | $strctId = $this->magicGetToplevelId(); |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | } else { |
| 1354 | 1354 | $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
| 1355 | 1355 | } |
| 1356 | - $this->thumbnailLoaded = true; |
|
| 1356 | + $this->thumbnailLoaded = TRUE; |
|
| 1357 | 1357 | } |
| 1358 | 1358 | return $this->thumbnail; |
| 1359 | 1359 | } |
@@ -1431,8 +1431,8 @@ discard block |
||
| 1431 | 1431 | public function __toString(): string |
| 1432 | 1432 | { |
| 1433 | 1433 | $xml = new \DOMDocument('1.0', 'utf-8'); |
| 1434 | - $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
|
| 1435 | - $xml->formatOutput = true; |
|
| 1434 | + $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
|
| 1435 | + $xml->formatOutput = TRUE; |
|
| 1436 | 1436 | return $xml->saveXML(); |
| 1437 | 1437 | } |
| 1438 | 1438 | |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | public function __wakeup(): void |
| 1448 | 1448 | { |
| 1449 | 1449 | $xml = Helper::getXmlFileAsString($this->asXML); |
| 1450 | - if ($xml !== false) { |
|
| 1450 | + if ($xml !== FALSE) { |
|
| 1451 | 1451 | $this->asXML = ''; |
| 1452 | 1452 | $this->xml = $xml; |
| 1453 | 1453 | // Rebuild the unserializable properties. |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class; |
| 79 | 79 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/MetsDocument.php']['hookClass'][] = \Kitodo\Dlf\Hooks\KitodoProductionHacks::class; |
| 80 | 80 | // Register AJAX eID handlers. |
| 81 | -if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['dlf']['general']['enableInternalProxy'] ?? false) { |
|
| 81 | +if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['dlf']['general']['enableInternalProxy'] ?? FALSE) { |
|
| 82 | 82 | $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Eid\PageViewProxy::class . '::main'; |
| 83 | 83 | } |
| 84 | 84 | // Use Caching Framework for Solr queries |
@@ -66,20 +66,20 @@ |
||
| 66 | 66 | $_EXTKEY = 'dlf'; |
| 67 | 67 | // Register tools for toolbox plugin. |
| 68 | 68 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] = []; |
| 69 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_fulltexttool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.fulltexttool'; |
|
| 70 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_annotationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.annotationtool'; |
|
| 71 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_fulltextdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.fulltextdownloadtool'; |
|
| 72 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_imagedownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.imagedownloadtool'; |
|
| 73 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_imagemanipulationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.imagemanipulationtool'; |
|
| 74 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_pdfdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.pdfdownloadtool'; |
|
| 75 | -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_searchindocumenttool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.searchindocumenttool'; |
|
| 69 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_fulltexttool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.fulltexttool'; |
|
| 70 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_annotationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.annotationtool'; |
|
| 71 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_fulltextdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.fulltextdownloadtool'; |
|
| 72 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_imagedownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.imagedownloadtool'; |
|
| 73 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_imagemanipulationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.imagemanipulationtool'; |
|
| 74 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_pdfdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.pdfdownloadtool'; |
|
| 75 | +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_searchindocumenttool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.searchindocumenttool'; |
|
| 76 | 76 | // Register hooks. |
| 77 | 77 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class; |
| 78 | 78 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class; |
| 79 | 79 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/MetsDocument.php']['hookClass'][] = \Kitodo\Dlf\Hooks\KitodoProductionHacks::class; |
| 80 | 80 | // Register AJAX eID handlers. |
| 81 | 81 | if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['dlf']['general']['enableInternalProxy'] ?? false) { |
| 82 | - $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Eid\PageViewProxy::class . '::main'; |
|
| 82 | + $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Eid\PageViewProxy::class.'::main'; |
|
| 83 | 83 | } |
| 84 | 84 | // Use Caching Framework for Solr queries |
| 85 | 85 | $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr'] ??= []; |
@@ -21,14 +21,14 @@ |
||
| 21 | 21 | { |
| 22 | 22 | parent::setUp(); |
| 23 | 23 | |
| 24 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.csv'); |
|
| 25 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/metadata.csv'); |
|
| 26 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.csv'); |
|
| 24 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/documents_1.csv'); |
|
| 25 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/metadata.csv'); |
|
| 26 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/MetsDocument/metadata_mets.csv'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | protected function doc(string $file) |
| 30 | 30 | { |
| 31 | - $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file; |
|
| 31 | + $url = 'http://web:8001/Tests/Fixtures/MetsDocument/'.$file; |
|
| 32 | 32 | $doc = AbstractDocument::getInstance($url, ['general' => ['useExternalApisForMetadata' => 0]]); |
| 33 | 33 | self::assertNotNull($doc); |
| 34 | 34 | return $doc; |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | use Kitodo\Dlf\Common\AbstractDocument; |
| 16 | 16 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
| 17 | 17 | |
| 18 | -class MetsDocumentTest extends FunctionalTestCase |
|
| 19 | -{ |
|
| 18 | +class MetsDocumentTest extends FunctionalTestCase { |
|
| 20 | 19 | public function setUp(): void |
| 21 | 20 | { |
| 22 | 21 | parent::setUp(); |
@@ -26,8 +25,7 @@ discard block |
||
| 26 | 25 | $this->importCSVDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.csv'); |
| 27 | 26 | } |
| 28 | 27 | |
| 29 | - protected function doc(string $file) |
|
| 30 | - { |
|
| 28 | + protected function doc(string $file) { |
|
| 31 | 29 | $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file; |
| 32 | 30 | $doc = AbstractDocument::getInstance($url, ['general' => ['useExternalApisForMetadata' => 0]]); |
| 33 | 31 | self::assertNotNull($doc); |
@@ -37,8 +35,7 @@ discard block |
||
| 37 | 35 | /** |
| 38 | 36 | * @test |
| 39 | 37 | */ |
| 40 | - public function canParseDmdAndAmdSec() |
|
| 41 | - { |
|
| 38 | + public function canParseDmdAndAmdSec() { |
|
| 42 | 39 | $doc = $this->doc('av_beispiel.xml'); |
| 43 | 40 | |
| 44 | 41 | $toplevelMetadata = $doc->getToplevelMetadata(20000); |
@@ -56,8 +53,7 @@ discard block |
||
| 56 | 53 | /** |
| 57 | 54 | * @test |
| 58 | 55 | */ |
| 59 | - public function canReadFileMetadata() |
|
| 60 | - { |
|
| 56 | + public function canReadFileMetadata() { |
|
| 61 | 57 | $doc = $this->doc('av_beispiel.xml'); |
| 62 | 58 | |
| 63 | 59 | $thumbsMeta = $doc->getMetadata('FILE_0000_THUMBS', 20000); |
@@ -72,8 +68,7 @@ discard block |
||
| 72 | 68 | /** |
| 73 | 69 | * @test |
| 74 | 70 | */ |
| 75 | - public function canGetLogicalStructure() |
|
| 76 | - { |
|
| 71 | + public function canGetLogicalStructure() { |
|
| 77 | 72 | $doc = $this->doc('av_beispiel.xml'); |
| 78 | 73 | |
| 79 | 74 | $toc = $doc->tableOfContents[0] ?? []; |
@@ -109,8 +104,7 @@ discard block |
||
| 109 | 104 | /** |
| 110 | 105 | * @test |
| 111 | 106 | */ |
| 112 | - public function doesNotOverwriteFirstDmdSec() |
|
| 113 | - { |
|
| 107 | + public function doesNotOverwriteFirstDmdSec() { |
|
| 114 | 108 | $doc = $this->doc('two_dmdsec.xml'); |
| 115 | 109 | |
| 116 | 110 | $toplevelMetadata = $doc->getToplevelMetadata(20000); |
@@ -123,8 +117,7 @@ discard block |
||
| 123 | 117 | /** |
| 124 | 118 | * @test |
| 125 | 119 | */ |
| 126 | - public function returnsEmptyMetadataWhenNoDmdSec() |
|
| 127 | - { |
|
| 120 | + public function returnsEmptyMetadataWhenNoDmdSec() { |
|
| 128 | 121 | $doc = $this->doc('two_dmdsec.xml'); |
| 129 | 122 | |
| 130 | 123 | // DMD and AMD works |
@@ -143,8 +136,7 @@ discard block |
||
| 143 | 136 | /** |
| 144 | 137 | * @test |
| 145 | 138 | */ |
| 146 | - public function canGetDownloadLocation() |
|
| 147 | - { |
|
| 139 | + public function canGetDownloadLocation() { |
|
| 148 | 140 | $doc = $this->doc('two_dmdsec.xml'); |
| 149 | 141 | |
| 150 | 142 | $correct = $doc->getDownloadLocation('FILE_0000_DOWNLOAD'); |
@@ -162,8 +154,7 @@ discard block |
||
| 162 | 154 | /** |
| 163 | 155 | * @test |
| 164 | 156 | */ |
| 165 | - public function canGetFileLocation() |
|
| 166 | - { |
|
| 157 | + public function canGetFileLocation() { |
|
| 167 | 158 | $doc = $this->doc('two_dmdsec.xml'); |
| 168 | 159 | |
| 169 | 160 | $correct = $doc->getFileLocation('FILE_0000_DEFAULT'); |
@@ -176,8 +167,7 @@ discard block |
||
| 176 | 167 | /** |
| 177 | 168 | * @test |
| 178 | 169 | */ |
| 179 | - public function canGetFileMimeType() |
|
| 180 | - { |
|
| 170 | + public function canGetFileMimeType() { |
|
| 181 | 171 | $doc = $this->doc('two_dmdsec.xml'); |
| 182 | 172 | |
| 183 | 173 | $correct = $doc->getFileMimeType('FILE_0000_DEFAULT'); |
@@ -191,8 +181,7 @@ discard block |
||
| 191 | 181 | /** |
| 192 | 182 | * @test |
| 193 | 183 | */ |
| 194 | - public function canGetPhysicalPage() |
|
| 195 | - { |
|
| 184 | + public function canGetPhysicalPage() { |
|
| 196 | 185 | $doc = $this->doc('mets_with_pages.xml'); |
| 197 | 186 | |
| 198 | 187 | // pass orderlabel and retrieve order |
@@ -203,8 +192,7 @@ discard block |
||
| 203 | 192 | /** |
| 204 | 193 | * @test |
| 205 | 194 | */ |
| 206 | - public function canGetTitle() |
|
| 207 | - { |
|
| 195 | + public function canGetTitle() { |
|
| 208 | 196 | $doc = $this->doc('mets_with_pages.xml'); |
| 209 | 197 | |
| 210 | 198 | $correct = $doc->getTitle(1001); |
@@ -217,8 +205,7 @@ discard block |
||
| 217 | 205 | /** |
| 218 | 206 | * @test |
| 219 | 207 | */ |
| 220 | - public function canGetFullText() |
|
| 221 | - { |
|
| 208 | + public function canGetFullText() { |
|
| 222 | 209 | $doc = $this->doc('mets_with_pages.xml'); |
| 223 | 210 | |
| 224 | 211 | $fulltext = $doc->getFullText('PHYS_0003'); |
@@ -234,8 +221,7 @@ discard block |
||
| 234 | 221 | /** |
| 235 | 222 | * @test |
| 236 | 223 | */ |
| 237 | - public function canGetStructureDepth() |
|
| 238 | - { |
|
| 224 | + public function canGetStructureDepth() { |
|
| 239 | 225 | $doc = $this->doc('mets_with_pages.xml'); |
| 240 | 226 | |
| 241 | 227 | $correct = $doc->getStructureDepth('LOG_0001'); |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class DocumentValidator |
| 31 | 31 | { |
| 32 | - /** |
|
| 33 | - * @access protected |
|
| 34 | - * @var Logger This holds the logger |
|
| 35 | - */ |
|
| 32 | + /** |
|
| 33 | + * @access protected |
|
| 34 | + * @var Logger This holds the logger |
|
| 35 | + */ |
|
| 36 | 36 | protected Logger $logger; |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | foreach ($this->requiredMetadataFields as $requiredMetadataField) { |
| 84 | 84 | if (empty($this->metadata[$requiredMetadataField][0])) { |
| 85 | - $this->logger->error('Missing required metadata field "' . $requiredMetadataField . '".'); |
|
| 85 | + $this->logger->error('Missing required metadata field "'.$requiredMetadataField.'".'); |
|
| 86 | 86 | return false; |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -100,14 +100,14 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function hasCorrectLogicalStructure(string $type): bool |
| 102 | 102 | { |
| 103 | - $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="' . $type . '"]'); |
|
| 103 | + $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="'.$type.'"]'); |
|
| 104 | 104 | if ($expectedNodes) { |
| 105 | 105 | return true; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $existingNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
| 109 | 109 | if ($existingNodes) { |
| 110 | - $this->logger->error('Document contains logical structure but @TYPE="' . $type . '" is missing.'); |
|
| 110 | + $this->logger->error('Document contains logical structure but @TYPE="'.$type.'" is missing.'); |
|
| 111 | 111 | return false; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @access public |
| 29 | 29 | */ |
| 30 | -class DocumentValidator |
|
| 31 | -{ |
|
| 30 | +class DocumentValidator { |
|
| 32 | 31 | /** |
| 33 | 32 | * @access protected |
| 34 | 33 | * @var Logger This holds the logger |
@@ -63,8 +62,7 @@ discard block |
||
| 63 | 62 | * |
| 64 | 63 | * @return void |
| 65 | 64 | */ |
| 66 | - public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null) |
|
| 67 | - { |
|
| 65 | + public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null) { |
|
| 68 | 66 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
| 69 | 67 | $this->metadata = $metadata; |
| 70 | 68 | $this->requiredMetadataFields = $requiredMetadataFields; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null) |
|
| 66 | + public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = NULL) |
|
| 67 | 67 | { |
| 68 | 68 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
| 69 | 69 | $this->metadata = $metadata; |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | foreach ($this->requiredMetadataFields as $requiredMetadataField) { |
| 84 | 84 | if (empty($this->metadata[$requiredMetadataField][0])) { |
| 85 | 85 | $this->logger->error('Missing required metadata field "' . $requiredMetadataField . '".'); |
| 86 | - return false; |
|
| 86 | + return FALSE; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | - return true; |
|
| 89 | + return TRUE; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -102,17 +102,17 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="' . $type . '"]'); |
| 104 | 104 | if ($expectedNodes) { |
| 105 | - return true; |
|
| 105 | + return TRUE; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $existingNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
| 109 | 109 | if ($existingNodes) { |
| 110 | 110 | $this->logger->error('Document contains logical structure but @TYPE="' . $type . '" is missing.'); |
| 111 | - return false; |
|
| 111 | + return FALSE; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $this->logger->error('Document does not contain logical structure.'); |
| 115 | - return false; |
|
| 115 | + return FALSE; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -126,16 +126,16 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | $physSequenceNodes = $this->xml->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]'); |
| 128 | 128 | if ($physSequenceNodes) { |
| 129 | - return true; |
|
| 129 | + return TRUE; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $physicalStructureNodes = $this->xml->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div'); |
| 133 | 133 | if ($physicalStructureNodes) { |
| 134 | 134 | $this->logger->error('Document contains physical structure but @TYPE="physSequence" is missing.'); |
| 135 | - return false; |
|
| 135 | + return FALSE; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $this->logger->error('Document does not contain physical structure.'); |
| 139 | - return false; |
|
| 139 | + return FALSE; |
|
| 140 | 140 | } |
| 141 | 141 | } |